Описание тега asort
This is a PHP function to sort arrays. Returns either TRUE or FALSE.
asort()
takes in an array as argument and sorts this array while maintaining the index associations. Since the passed array is taken as pass-by-reference, the original array itself is updated/sorted.
Short Info
This function sorts an array such that array indices maintain their correlation with the array elements they are associated with. This is used mainly when sorting associative arrays where the actual element order is significant. The function returns TRUE
on success or FALSE
on failure.
Usage
bool asort ( array &$array [, int $sort_flags = SORT_REGULAR ] )
bool
is the return value type.array
is passed variable type.$sort_flags
is optional parameter to modify sorting feature.
More information on the sort_flags
is available here.
Miscellaneous
The functionarsort()
can be used to reverse sort the arrays.