In this program some number given in array. using for loop sorting number.
Here is full code.....
<?php
$ab=array(5,8,4,7,2,3,9);
for($i=0;$i<count($ab)-1;$i++)
{
for($j=0;$j<count($ab)-1;$j++)
{
if($ab[$j] < $ab[$j+1])
{
$highnum=$ab[$j];
$ab[$j]=$ab[$j+1];
$ab[$j+1] = $highnum;
}
}
}
for($i=0;$i<count($ab);$i++)
{
echo $ab[$i];
echo "<br>";
}
?>
Labels: PHP