sort
bool sort(array array, [int flag])
array | Array to be sorted |
flag | Flag specifying how to compare key values (PHP 4.0.0+ only) |
Sorts an array in ascending order by element value.
Returns:
TRUE on success; FALSE on failure
Description:
Sorts array in ascending order by element value. String indexes are ignored and the resulting array is indexed numerically. Use asort() if you’re working with an associative array. The key values for the resulting indexed array are reordered after the sort is complete.
array is modified directly by this function.
(PHP 4.0.0+ only) The way in which element values are compared can be modified by passing one of the following named constants as flag :
SORT_REGULAR | Compare element values according to PHP’s normal ... |
Get PHP Functions Essential Reference now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.