Sort multi-dimensional arrays by a field. When you see the role of the array_multisort method, you can use this method without functionsortArrByField ($ array, $ field, $ descfalse) {$ fieldArrarray (); foreach ($ arrayas $ k $ v) {$ fieldArr [$ k] $ v [$ field];} $ sort
Sort multi-dimensional arrays by a field. When you see the role of the array_multisort method, you can use this method without function sortArrByField ($ array, $ field, $ desc = false) {$ fieldArr = array (); foreach ($ array as $ k = $ v) {$ fieldArr [$ k] = $ v [$ field];} $ sort =
Sort the multi-dimensional array based on a field. When you see the role of the array_multisort method, you can use this method. <无>
function sortArrByField(&$array, $field, $desc = false){ $fieldArr = array(); foreach ($array as $k => $v) { $fieldArr[$k] = $v[$field]; } $sort = $desc == false ? SORT_ASC : SORT_DESC; array_multisort($fieldArr, $sort, $array);}