PHP array_multisort function
Last Updated: February 14, 2022
array_multisort – sort multiple or multi dimention arrays
Syntax
array_multisort(
array &$array1,
mixed $array1_sort_order = SORT_ASC,
mixed $array1_sort_flags = SORT_REGULAR,
mixed ...$rest
): bool
Supports (PHP 4, PHP 5, PHP 7, PHP 8)
Parameters
Parameter | Description |
arrays | Required. list of arrays for merging |
array1_sort_order |
specify the sort order of the array
|
array1_sort_flags |
Sorting type flags:
|
Return Value
Returns true
on success or false
on failure.
Example
<?php
$ar1 = array("a", "C","B");
array_multisort($ar1);
print_r($ar1);
?>
Output
Array ( [0] => B [1] => C [2] => a )