The PHP array is sorted by a field

Source: Internet
Author: User

//$arrays the array to sort, $sort _key the name of the key to sort
functionMy_sort ($arrays,$sort _key,$sort _order=sort_desc,$sort _type=sort_numeric) { if(Is_array($arrays)){ foreach($arrays as $array){ if(Is_array($array)){ $key _arrays[] =$array[$sort _key]; }Else{ return false; } } }Else{ return false; } Array_multisort($key _arrays,$sort _order,$sort _type,$arrays); return $arrays;}

The PHP array is sorted by a field

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.