php man page for krsort

Query: krsort

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

KRSORT(3)								 1								 KRSORT(3)

krsort - Sort an array by key in reverse order

SYNOPSIS
bool krsort (array &$array, [int $sort_flags = SORT_REGULAR])
DESCRIPTION
Sorts an array by key in reverse order, maintaining key to data correlations. This is useful mainly for associative arrays.
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 krsort(3) example <?php $fruits = array("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); krsort($fruits); foreach ($fruits as $key => $val) { echo "$key = $val "; } ?> The above example will output: d = lemon c = apple b = banana a = orange
SEE ALSO
arsort(3), ksort(3), The comparison of array sorting functions. PHP Documentation Group KRSORT(3)
Related Man Pages
array_replace(3) - php
array(3) - php
array_unique(3) - php
array_unshift(3) - php
uksort(3) - php
Similar Topics in the Unix Linux Community
Please Welcome Don Cragun as Lead Moderator
Status of UNIX.COM Forum Transformation
Please Welcome Ravinder Singh to the Moderation Team
The Order of the Wizard's Hat - Lifetime Achievement Award 2019 - Congrats to Wolf Machowitsch
Please Welcome Nicki Paul to the Moderator Team!