PHP Array Functions

rsort() Function

Definition and Usage

The rsort() function sorts an indexed array in descending order.


Syntax

rsort(array)


Parameter Description
array Required. Specifies the array to use

Example

Sort the elements of the $numbers array in descending numerical order:

<?php
$numbers=array(4,6,2,22,11);
rsort($numbers);
?>

Run Example>>