array_multisort: Sort multiple or multi-dimensional arrays
<?php
$staff["givenname"][0] = "A";
$staff["givenname"][1] = "B";
$staff["givenname"][2] = "C";
$staff["givenname"][3] = "D";
$staff["surname"][0] = "E";
$staff["surname"][1] = "F";
$staff["surname"][2] = "G";
$staff["surname"][3] = "H";
$res = array_multisort($staff["surname"],SORT_STRING,SORT_ASC,$staff["givenname"],SORT_STRING,SORT_ASC);
print_r($staff);
?>
Related examples in the same category