This article mainly introduces how array_multisort sorts multi-dimensional arrays in php. It involves php's skills in traversing arrays and using array_multisort to sort arrays. For more information, see
This article mainly introduces how array_multisort sorts multi-dimensional arrays in php. It involves php's skills in traversing arrays and using array_multisort to sort arrays. For more information, see
This article describes how array_multisort sorts multi-dimensional arrays in php. Share it with you for your reference. The specific implementation method is as follows:
Function sort_array ($ array, $ keyid, $ order = 'asc ', $ type = 'number') {if (is_array ($ array )) {foreach ($ array as $ val) {$ order_arr [] = $ val [$ keyid];} $ order = ($ order = 'asc ')? SORT_ASC: SORT_DESC; $ type = ($ type = 'number ')? SORT_NUMERIC: SORT_STRING; array_multisort ($ order_arr, $ order, $ type, $ array );}}
I hope this article will help you with php programming.
,