krsort

It sorts an array by key in reverse order

Example

<?php
echo “<pre>”;
$lan = array(1=>”PHP”,2=> “ASP”, 3=>”JSP”);
krsort($lan);
print_r($lan);
?>

Output

Array
(
[3] => JSP
[2] => ASP
[1] => PHP
)

Share