Sorts an array in descending order by key.
krsort() works like ksort(), but sorts in descending order.The elements are ordered by key, rather than value of the elements. The optional sort_type parameter specifies whether the elements should be sorted as strings or numerically. If the array was sorted successfully, TRUE is returned.
<body>
<pre>
<?php
$cities = array(
"Miami" => "Florida",
"New Orleans" => "Louisiana",
"Los Angeles" => "California",
"Atlanta" => "Georgia",
"Memphis" => "Tennessee");
krsort($cities);
print_r($cities);
?>
</pre>
Array
(
[New Orleans] => Louisiana
[Miami] => Florida
[Memphis] => Tennessee
[Los Angeles] => California
[Atlanta] => Georgia
)
An array with cities as keys and states as values is sorted with krsort().