For Your Desired output use this code:
67, 'specialties' => 1);
$waiters[14] = array('weight' => 41, 'specialties' => 2);
$waiters[58] = array('weight' => 85, 'specialties' => 3);
$waiters[89] = array('weight' => 98, 'specialties' => 4);
$waiters[68] = array('weight' => 86, 'specialties' => 5);
$waiters[31] = array('weight' => 13, 'specialties' => 6);
//ksort($waiters);
//$waiters = array_reverse($waiters, true);
print_r($waiters);
// Obtain a list of waiters
foreach($waiters as $id=>$w){
$w[$id] = $w['weight'];
}
foreach ($waiters as $ii => $va) {
$sorter[$ii] = $va['weight'];
}
natcasesort($sorter);
foreach ($sorter as $ii => $va) {
$ret[$ii] = $waiters[$ii];
}
echo "";
$ret = array_reverse($ret, true);
print_r($ret);
?>