Copyright © tutorialspoint.com
| rsort( $array [, $sort_flags] ); |
This function sorts an array in reverse order (highest to lowest).
This function assigns new keys for the elements in array. It will remove any existing keys you may have assigned, rather than just reordering the keys.
| Parameter | Description |
|---|---|
| array | Required. Specifies an array. |
| sort_flags | Optional. Specifies how to sort the array values. Possible values:
|
Returns TRUE on success or FALSE on failure.
Try out following example:
<?php
$fruits = array("d"=>"lemon", "a"=>"orange", "b"=>"banana" );
rsort($fruits);
print_r($fruits);
?>
|
This will produce following result:
Array ( [0] => orange [1] => lemon [2] => banana ) |
Copyright © tutorialspoint.com