php man page for rsort

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 order

SYNOPSIS
bool rsort (array &$array, [int $sort_flags = SORT_REGULAR])
DESCRIPTION
This function sorts an array in reverse order (highest to lowest).
PARAMETERS
o $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 VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #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.
NOTES
Note 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 ALSO
arsort(3), krsort(3), The comparison of array sorting functions. PHP Documentation Group RSORT(3)
Related Man Pages
array_shift(3) - php
usort(3) - php
array_walk(3) - php
asort(3) - php
sort(3) - php
Similar Topics in the Unix Linux Community
parse by string and difference in substring???
sort -reverse order
Variable resolution in File content
Remove blank space and insert special character
Sort from highest to lowest number