/**
* Notes: 排序
* User: Sen
* DateTime: 2020/7/8 14:23
* Return:
*/
public function arraySort($array,$keys,$sort='asc') {
$newArr = $valArr = array();
foreach ($array as $key=>$value) {
$valArr[$key] = $value[$keys];
}
($sort == 'asc') ? asort($valArr) : arsort($valArr);
reset($valArr);
foreach($valArr as $key=>$value) {
$newArr[$key] = $array[$key];
}
return $newArr;
}
网友评论