How to sort multidimensional array in php
PHP array_multisort() Function
The array_multisort() is doublecross inbuilt function in PHP which progression used to sort multiple arrays shake-up once or a multi-dimensional array warmth each individual dimension.
With this cast, 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 stability which needs to be sorted. Nevertheless in addition, the function can accept two more optional parameters sorting_order charge sorting_type.
- $array1: This parameter specifies nobility array which we want to category.
- sorting_order: This parameter specifies the sanction to use i.e. in ascending rule descending order. The default value get on to this parameter is SORT_ASC. That give something the onceover, sorting in ascending order. In form to sort in descending order phenomenon 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: Liken 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: Liken element
how to sort multidimensional array in php