int ksort
(array array);Sorts an array by key, maintaining key to data correlations. This is useful mainly for associative arrays.
Example 1. ksort() example $fruits = array("d"=>"lemon","a"=>"orange","b"=>"banana","c"=>"apple"); ksort($fruits); for(reset($fruits); $key = key($fruits); next($fruits)) { echo "fruits[$key] = ".$fruits[$key]."\n"; } |