Home > Article > Backend Development > PHP two-dimensional array sorted according to a certain field
//Array order size
function ArrMax($data,$arrkey){
$tree = array();
foreach ($data as $key=>$val)
{
$pro[]=$val [$arrkey];
}
array_multisort($pro,SORT_DESC);
for($j=0;$j
if($pro[$j]==$data[$i][$arrkey]){
$tree[$j] = $data[$i];
}
}
}
return $tree;
}