PHP/Data Structure/array multisort
array_multisort
<?php
$staff["givenname"][0] = "J";
$staff["givenname"][1] = "M";
$staff["givenname"][2] = "G";
$staff["surname"][1] = "C";
$staff["surname"][2] = "G";
$staff["surname"][3] = "E";
$res = array_multisort($staff["surname"],SORT_STRING,SORT_ASC,
$staff["givenname"],SORT_STRING,SORT_ASC);
print_r($staff);
?>
array_multisort for Array Keys with a Given Value
<?php
$clothes = array( "hats" => 75, "coats" => 32, "shoes" => 102);
$names = array_keys($clothes);
$items = array_values($clothes);
array_multisort($items, $names);
$num = count($clothes) - 1;
printf("<p>Most items: %s (%d); least items: %s (%d).</p>\n",$names[$num], $items[$num], $names[0], $items[0]);
?>