How Do you Sort an Array in Descending Order in PHP
In this lesson, we will see how to sort descending an array in PHP, we will use the rsort() function that sorts an indexed array in descending order.
Sort descending an array in PHP
The example below shows how you can sort descending an array in PHP.
$notes = array( 12, 15, 4);
//sort arrays in descending order
rsort($notes);
print_r($notes);
//Array ( [0] => 15 [1] => 12 [2] => 4 )