|
| SORTING ARRAYS WITH THE krsort() FUNCTION
The krsort() function sorts an array by key in reverse order. Each value's original key is retained.
The general format for the krsort() function is:
krsort($array);
Example:
$username['John']="Elmafudd";
$username['Alieza']="8hotchick";
$username['Brian']="aopper24";
$username['Mary']="11_daper";
krsort($username);
The array is now.
$username['Mary'] = 11_daper
$username['John'] = Elmafudd
$username['Brian'] = aopper24
$username['Alieza'] = 8hotchick
See also:
|
|