PHP.nl

rsort

rsort

Sort an array in descending order

true **rsort** array $array int $flags

Sorts in place by values in descending order. array

arrayThe input array.

return.true.always

Voorbeeld: example

<?php
$fruits = array("lemon", "orange", "banana", "apple");
rsort($fruits);
foreach ($fruits as $key => $val) {
    echo "$key = $val\n";
}
?>
0 = orange
1 = lemon
2 = banana
3 = apple

The fruits have been sorted in reverse alphabetical order.

sort``arsort``krsort