|
| SORTING ARRAYS WITH THE arsort() FUNCTION
The arsort() function sorts an array's values in reverse order. Keeps the same keys.
The general format for the arsort() function is:
arsort($array);
This sorts the array by value, sorted by lowercase letters first descending , then uppercase letters descending and lastly numbers descending.
Example:
$username['John']="Elmafudd";
$username['Alieza']="8hotchick";
$username['Brian']="aopper24";
$username['Mary']="11_daper";
arsort($username);
The array is now.
username['Brian'] = aopper24
$username['John'] = Elmafudd
$username['Alieza'] = 8hotchick
$username['Mary'] = 11_daper
See also:
|
|