this program is to sort  an array using php predefined function rsort()



rsort():-


The rsort() function sorts an indexed array in descending order.



code:-



<!DOCTYPE html>

<html>

<body>


<?php


$cars=array("Volvo","BMW","Toyota");


rsort($cars);


$clength=count($cars);


for($x=0;$x<$clength;$x++)

  {

  echo $cars[$x];


  echo "<br>";

  }

?>


</body>

</html>


output:-


Volvo
Toyota
BMW


Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post