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