$sort = array(
'direction' => 'SORT_DESC',
'field' => 'level',
);
$arrSort = array();
foreach($tmp AS $uniqid => $row){
foreach($row AS $key=>$value){
$arrSort[$key][$uniqid] = $value;
}
}
if($sort['direction']){
array_multisort($arrSort[$sort['field']], constant($sort['direction']), $tmp);
}