Q:

Write a PHP script to sort an array in reverse order (highest to lowest)

0

Write a PHP script to sort an array in reverse order (highest to lowest).

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

<?php
$colors = array("Red", "Orange", "Black", "White");
rsort($colors);
print_r($colors);
?>

Sample Output:

Array                                                       
(                                                           
    [0] => White                                            
    [1] => Red                                              
    [2] => Orange                                           
    [3] => Black                                            
)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now