rsort(3) php man page | unix.com

Man Page: rsort

Operating Environment: php

Section: 3

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
rsort(3) - php
usort(3) - php
array(3) - php
sort(3) - php
limititerator(3) - php
Similar Topics in the Unix Linux Community
Sort on two keys
sort -reverse order
Column update
Getting contents of line using a selected one as reference
Question about sorting -- how to pass an array to a function