PHP two-dimensional array sorted according to a certain field

巴扎黑
Release: 2016-11-23 09:37:12
Original
1218 people have browsed it

//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;$jfor($i=0;$i{
if($pro[$j]==$data[$i][$arrkey]){
$tree[$j] = $data[$i];
}
}
}
return $tree;
}


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template