-
-
Save k1ic/631044b886e761919da92a20a3b846a6 to your computer and use it in GitHub Desktop.
sort
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function _sort($arr = array(), $sort_filed = '', $sort_direction = self::HOT_LIST_SORT_ASC) { | |
$sort = array( | |
'direction' => $sort_direction, //排序顺序标志,SORT_DESC:降序,SORT_ASC:升序 | |
'field' => $sort_filed, //排序字段 | |
); | |
$arr_sort = array(); | |
foreach ($arr as $uniqid => $row) { | |
foreach ($row as $k => $v) { | |
$arr_sort[$k][$uniqid] = $v; | |
} | |
} | |
if (isset($sort['direction'])) { | |
array_multisort($arr_sort[$sort['field']], constant($sort['direction']), $arr); | |
} | |
return $arr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment