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