This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

PHP Arrays

Sort Array in Descending Order - rsort()

Volvo
Toyota
BMW

<?php
// define $cars array
$cars = array("Volvo", "BMW", "Toyota");

// sort array in descending order
rsort($cars);

// display the array in descending order
$clength = count($cars);
for($x = 0; $x < $clength; $x++) {
  echo $cars[$x];
  echo "<br>";
}
?>