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()

22
11
6
4
2

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

// sort the array in descending order
rsort($numbers);

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