This rsort() function is used to sort an array in reverse order (highest to lowest).
Note: If two members compare as equal, their relative order in the sorted array is undefined.
TRUE on success. FALSE on failure
Parameter | Description |
---|---|
array | Required. Specifies the array to sort |
sortingtype | Optional. Specifies how to compare the array elements/items. Possible values: |
Syntax
rsort(array,sortingtype);
Example
$people = array("James","Lachlan","Cooper");
rsort($people);
print_r($people);
Output
Array ( [0] => Lachlan [1] => James [2] => Cooper )