Array_multisort () sorts multiple arrays or multi-dimensional arrays [function] This function can be used to sort multiple arrays at a time, or sort the multi-dimensional arrays according to a certain dimension or dimension. [range of use] php4, php5. [use] boolarray_multisort (arra... syntaxHighligh
Array_multisort () sorts multiple arrays or multi-dimensional arrays.
[Function]
This function can be used to sort multiple arrays at a time, or to sort multi-dimensional arrays based on one or more dimensions.
Scope of use]
Php4, php5.
[Use]
Bool array_multisort (array array1 [, mixed array2 [, mixed... [, array...])
Arrayn/required/array to be sorted
The remaining parameters are arrays or flags.
Sort SORT_ASC in ascending order
Sort SORT_DESC in descending order
SORT_REGULAR compares projects according to the common method
SORT_NUMERIC compares projects by numerical values
SORT_STRING is used to compare items by string
You cannot specify the same sort flag after each array.
The sorting flag specified behind each array is only valid for this array. prior to this, the default values are SORT_ASC and SORT_REGULAR.
[Example]
[Php]
$ Arr1 = array ("ten", 100,100, "");
$ Arr2 = array (1, 3, "2", 1 );
Array_multisort ($ arr1, $ arr2 );
Var_dump ($ arr1 );
Var_dump ($ arr2 );
/*
Array (4 ){
[0] =>
String (2) "10"
[1] =>
String (1) ""
[2] =>
Int (100)
[3] =>
Int (100)
}
Array (4 ){
[0] =>
Int (1)
[1] =>
Int (1)
[2] =>
String (1) "2"
[3] =>
Int (3)
}
*/
Taken from zuodefeng's note