<?php
$arr=array(“3″=>”a”,”1″=>”b”,”2″=>”c”); ksort($arr);
print_r($arr); echo “<br>”; krsort($arr);
print_r(\$arr);

?>

Array ( [1] => b [2] => c [3] => a )
Array ( [3] => a [2] => c [1] => b )

ksort()正序

krsort()倒叙