Syntax
| array_multisort(array1,sorting order,sorting type,array2...); |
Definition and Usage
This can be used to sort several arrays at once, or a multi-dimensional array by one or more dimensions.
Paramters
| Parameter | Description |
|---|---|
| array1 | Required. Specifies an array |
| Sort order | Optional. Specifies the sorting order. Possible values:
|
| Sorting type | Optional. Specifies the type to use, when comparing elements. Possible values:
|
| array2 | Optional. Specifies an array |
Return Values
Returns TRUE on success or FALSE on failure.
Example
Try out following example:
<?php
$array1 = array("10", 100, 100, "a");
$array2 = array(1, 3, "2", 1);
array_multisort($array1, $array2);
print_r($array1);
print_r($array2);
?>
|
This will produce following result:
Array ( [0] => 10 [1] => a [2] => 100 [3] => 100 ) Array ( [0] => 1 [1] => 1 [2] => 2 [3] => 3 ) |
No comments:
Post a Comment