Asort () Definition and usage
The Asort () function sorts the array and maintains the index relationship. It is primarily used to sort the associative arrays that are important for the cell order.
The Second optional parameter contains an additional sort ID.
Returns TRUE if successful, otherwise FALSE.
Grammar
Asort (array,sorttype) parameter description
Array required. The input array.
SortType is optional. Specifies how the values of the array are arranged. Possible values:
Sort_regular-Default. Processed in their original type (without changing the type).
Sort_numeric-Handle the value as a number
Sort_string-handles the value as a string
Sort_locale_string-handles the value as a string, based on local settings *.
*: This value is new for PHP 4.4.0 and 5.0.2. Prior to PHP 6, the system's locale was used, which can be changed using setlocale (). From PHP 6, you must use the I18n_loc_set_default () function.
Example
Copy the Code code as follows:
$my _array = Array ("A" = "Dog", "b" = "Cat", "c" = "Horse");
Asort ($my _array);
Print_r ($my _array);
?>
Output:
Array
(
[B] = Cat
[A] = Dog
[C] = Horse
)
The above describes the PHP multidimensional array php array function sequence Asort-the array of element values in ascending order, maintain the index relationship, including the PHP multidimensional array content, I hope that the PHP tutorial interested in the help of friends.