PHP array functions-array sorting

Source: Internet
Author: User

PHP Array sorting function
Sort (& $arr [, fruits]) sorts the array from low to high and assigns a new key name back to BOOL
Rsort (& $arr [, fruits]) reverse sort the array and give the new key name
Asort (& $arr [, fruits]) sorts the array and keeps the index intact
Arsort (& $arr [, fruits]) reverse-sort the array and keep the index intact

Ksort (& $arr [, fruits]) sorts the array by key name
Krsort (& $arr [, fruits]) reverse-sort the number of groups by key name

Natsort (& $arr) ' Natural sorting ' of array key values by alphabetical order of length
Natcasesort (& $arr) An array of case-insensitive ' natural rankings '

Usort (& $arr, cmp_function) user-defined function to sort an array reorder key names
Uksort (& $arr, cmp_function) user-defined function to sort an array by key name
Uasort (& $arr, cmp_function) user-defined function sorts the array and keeps the index intact

Array_multisort ($arr, mixed)
The second parameter is the ability to change the sort behavior by value
Sort_regular Normal comparison unit sort_numeric unit is compared as a number
The sort_string unit is compared as a string srot_locale_string the cell as a string based on the current local setting.

PHP array functions-array sorting

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.