Sort multidimensional Array by Value

Posted by
function aasort (&$array, $key) {

 $sorter=array(); $ret=array(); reset($array);

 foreach ($array as $ii => $va) {

  $sorter[$ii]=$va[$key];

 }

 asort($sorter);   ////// asort  (for asc)  or arsort (for desc)

 foreach ($sorter as $ii => $va) {

 $ret[$ii]=$array[$ii];

 }
 
 $array=$ret;

}

aasort($your_array,"order");