1.usort()
<?php function re($a,$b){ return ($a>$b)?1:-1; } $x=array(1,3,2,5,9); usort($x, 're'); print_r($x); ?> Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 5 [4] => 9 )