Array_multisort
(PHP4 >= 4.0b4)
Array_multisort---&http://www.aliyun.com/zixun/aggregation/37954.html ">nbsp; Array of sorted composite or multiple dimensions
Syntax: bool Array_multisort (Array ar1 [, mixed arg [, mixed ... [, array ...]]
Description:
Array_multisort () can be used to sort a number of arrays or multiple dimensions (multi-dimensional) arrays immediately.
The input array is considered to be the field of the table. Sort it by column (rows), which is similar to the SQL ORDER BY clause function, the first array is the first (primary) sorted array, and the column (value) in this array is the same sort of array as the one entered.
The argument structure of this function is a unique (unusual) bit, but is flexible. The first argument must be an array, and then the argument can be one of the array or the sort flag (flag) of the next list.
Sort order Flag:
SORT_ASC-Sort into ascending order
Sort_desc-Sort into descending order
Sort Type flag:
Sort_regular-Normal comparison project
Sort_numeric-With a digital comparison project
Sort_string-as a string to compare items
You cannot use two identical flags to specify that after each array, the sorted flag is specified after the array argument, only for this array, and the others are reset to the preset sort_asc and sort_regular after the array argument.
Success returns TRUE, and failure returns false.
Example:
<?php
$ar 1 = Array ("a");
$ar 2 = Array (1, 3, "2", 1);
Array_multisort ($ar 1, $ar 2);
?>
After this example is sorted, the first array will be ten, "a", 100, 100, and the second array will be 1, 1, 2, "3".
Example:
<?php
$ar = Array ("Ten", "N", "a"), Array (1, 3, "2", 1));
Array_multisort ($ar [0], SORT_ASC, sort_string,
$ar [1], sort_numeric, SORT_DESC);
?>
After this example is sorted, the first array will be ten, "a" (It is considered a string and ascending sort), and the second array will be 1, 3, "2", 1 (it is considered numeric and descending sort).