Query: rsort
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
RSORT(3) 1 RSORT(3) rsort - Sort an array in reverse orderSYNOPSISbool rsort (array &$array, [int $sort_flags = SORT_REGULAR])DESCRIPTIONThis function sorts an array in reverse order (highest to lowest).PARAMETERSo $array - The input array. o $sort_flags - You may modify the behavior of the sort using the optional parameter $sort_flags, for details see sort(3).RETURN VALUESReturns TRUE on success or FALSE on failure.EXAMPLESExample #1 rsort(3) example <?php $fruits = array("lemon", "orange", "banana", "apple"); rsort($fruits); foreach ($fruits as $key => $val) { echo "$key = $val "; } ?> The above example will output: 0 = orange 1 = lemon 2 = banana 3 = apple The fruits have been sorted in reverse alphabetical order.NOTESNote This function assigns new keys to the elements in $array. It will remove any existing keys that may have been assigned, rather than just reordering the keys.SEE ALSOarsort(3), krsort(3), The comparison of array sorting functions. PHP Documentation Group RSORT(3)