Name
array_multisort
Synopsis
bool array_multisort(arrayarray1[, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING]] [, arrayarray2[, SORT_ASC|SORT_DESC [, SORT_REGULAR|SORT_NUMERIC|SORT_STRING]], ...])
Used to sort several arrays simultaneously, or to sort a multidimensional array in one or more dimensions. The input arrays are treated as columns in a table to be sorted by rows—the first array is the primary sort. Any values that compare the same according to that sort are sorted by the next input array, and so on.
The first argument is an array; following that, each argument may be an array or one of the following order flags (the order flags are used to change the default order of the sort):
|
|
Sort in ascending order |
|
|
Sort in descending order |
After that, a sorting type from the following list can be specified:
|
|
Compare items normally |
|
|
Compare items numerically |
|
|
Compare items as strings |
The sorting flags apply only to the immediately preceding array, and
they revert to SORT_ASC and
SORT_REGULAR before each new array argument.
This function returns true if the operation was
successful and false if not.