PHP3 Manual | ||
---|---|---|
Prev | Next |
ksort -- Sort an array by key.
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"; } |
Prev | Home | Next |
key | Up | list |