Sort destroys the sorting of index values in ascending order
Rsort destroys sorting of index values in descending order
Asort sort index values in ascending order
Arsort keeps the index sorted in descending order
Ksort keeps indexes sorted by key in ascending order)
Krsort keeps the index sorted by key in descending order)
Usort
This function uses a user-defined comparison function to sort the values in an array. If the array to be sorted needs to be sorted by an unusual standard, use this function.
A comparison function must return an integer less than, equal to, or greater than zero when the first parameter is considered to be less than, equal to, or greater than the second parameter.
Uksort
Uksort-sort the keys in the array using the User-Defined comparison Function
Cmp_functionThe function should accept two parameters, which will beArrayIn. When the first parameter is less than, equal to, or greater than the second parameter, the comparison function must return an integer less than zero, equal to zero, or greater than zero.
Natsort
This function implements a sorting algorithm that is the same as the method that people usually sort character strings and maintain the association of original keys/values. This is called "natural sorting ". This algorithm and the general computer string Sorting Algorithm
Bool natcasesort (array & $ array)Case Insensitive
This function implements a sorting algorithm that is the same as the method that people usually sort character strings and maintain the association of original keys/values. This is called "natural sorting ".
Return if successfulTRUE, Or return when the failure occurs.FALSE.
For example, to sort two-dimensional arrays, use the built-in functions asort and arsort.
The idea is to keep the key values of $ keyvalue and $ arr the same, and then assign the column $ arr wants to sort to $ keyvalue, and use the built-in function to sort $ keyvalue,
Finally, other columns of $ arr are returned Based on the unchanged key value.
Function array_sort ($ arr, $ keys, $ type = 'asc ')
{
Echo 'start sorting... '.' </br> ';
$ Keysvalue = $ new_array = array ();
Foreach ($ arr as $ k => $ v)
{
$ Keysvalue [$ k] = $ v [$ keys];
}
If ($ type = 'asc ')
{
}
Else
{
}
Reset ($ keysvalue );
Foreach ($ keysvalue as $ k => $ v)
{
$ New_array [$ k] = $ arr [$ k];
}
Echo 'sorting ends... '.' </br> ';
Return $ new_array;
}