Sort Array in Descending Order – rsort()

The following example sorts the elements of the $cars array in descending alphabetical order:

<?php
$cars = array("Volvo", "BMW", "Toyota");
rsort($cars);
?>

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