|
| SORTING ARRAYS WITH THE asort() FUNCTION
The asort() function is used to sort arrays which have text (and not numbers) as keys. This sorts the array by value, sorted with numbers first ascending, then uppercase letters alphabetically, then lowercase letters alphabetically. The original text keys remain unchanged.
The general format for the asort() function is:
asort($array);
Example:
$username['John']="Elmafudd";
$username['Alieza']="8hotchick";
$username['Brian']="aopper24";
$username['Mary']="11_daper";
asort($username);
The array is now.
$username['Mary'] = 11_daper
$username['Alieza'] = 8hotchick
$username['John'] = Elmafudd
$username['Brian'] = aopper24
See also:
|
|