krsort
Sort an array by key in descending order
&reftitle.description;
boolkrsort
arrayarray
intflagsSORT_REGULAR
Sorts an array by key in descending order, maintaining key to data
correlations. This is useful mainly for associative arrays.
&reftitle.parameters;
array
The input array.
&sort.flags.parameter;
&reftitle.returnvalues;
&return.success;
&reftitle.examples;
krsort example
"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
krsort($fruits);
foreach ($fruits as $key => $val) {
echo "$key = $val\n";
}
?>
]]>
&example.outputs;
&reftitle.seealso;
arsort
ksort
&seealso.array.sorting;