← All built-ins / rsort()

rsort()

rsort(array &$a): bool

Parameters

NameTypeDescription
$aarrayarray to sort (by reference)

Return value

true; sorted descending by value.

Example

$a = [3, 1, 2];
rsort($a);
echo implode(",", $a);
3,2,1

See also

sort()krsort()