asort

void asort(array array, [int flag]) 
array Array to be sorted
flag Flag specifying how to compare element values (PHP 4.0.0+ only)

Sorts the given array in ascending order.

Returns:

Nothing

Description:

Sorts the elements of the array given by array in ascending order by element value while maintaining the key/value associations. This function differs from sort() in that it works with both associative and indexed arrays; the a in asort() stands for associative.

This function operates directly on the passed array.

After calling asort(), the internal array pointer is on the first element of array .

(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 : ...

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.