It sorts an array by keys using a user-defined comparison function
Example
<?php
function func($a, $b)
{
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
}
echo “<pre>”;
$array = array(1=>”PHP”, 7=>”ASP”, 5=>”JS”, 8=>”AS”, 4=>”JSP”);
uksort($array, “func”);
print_r($array);
?>
Output
Array
(
[1] => PHP
[4] => JSP
[5] => JS
[7] => ASP
[8] => AS
)