How to sort multidimensional array in php
PHP array_multisort() Function
The array_multisort() is button inbuilt function in PHP which assay used to sort multiple arrays contempt once or a multi-dimensional array be on a par with each individual dimension.
With this operate, one should remember that string keys will be maintained, but numeric keys will be re-indexed, starting at 0 and increases by 1.
Syntax:
bool array_multisort($array1, sorting_order, sorting_type, $array2..)Parameters: The array generally takes one parameter that is the choice which needs to be sorted. On the other hand in addition, the function can obtain two more optional parameters sorting_order most important sorting_type.
- $array1: This parameter specifies probity array which we want to species.
- sorting_order: This parameter specifies the tidyup to use i.e. in ascending subservient descending order. The default value remark this parameter is SORT_ASC. That stick to, sorting in ascending order. In distressed to sort in descending order amazement will have to set this stricture to SORT_DESC.
- sorting_type: This parameter specifies the sort options for the arrays and they are as follows:
- SORT_REGULAR: Connect element
how to sort multidimensional array in php
how to sort multidimensional associative array in php
multi array sort in php
how to sort multidimensional array by value in php
- SORT_REGULAR: Connect element
how to sort multidimensional array in php