English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The rsort() function sorts an array in reverse order (from highest to lowest).
rsort(array $array[, int $sort_flags]);
This function sorts the array in reverse order (from highest to lowest).
Serial Number | Parameters and Description |
---|---|
1 | array(Required) It specifies an array. |
2 | sort_flags(Optional) It specifies how to sort the array values. Possible values-
|
Returns TRUE on success, FALSE on failure.
The array input is sorted in reverse alphabetical order.
<?php $input = array("d"=>"lemon", "a"=>"orange", "b"=>"banana"); rsort($input); print_r($input); ?>Test and See‹/›
Output Result
Array ( [0] => orange [1] => lemon [2] => banana )