I checked all the questions which have already been asked. I did not find the suitable one. The question is to sort and rsort an array but use sort and rsort unfunction is not allowed. It supposed to be done with for loop.
<?php
$numberstring = $_GET['numberstring'];
$array = explode(',',$numberstring);
echo "Order in the beginning: $numberstring\n";
// My code starts from here for the missing part
for ($i=0;$i<count($array);$i++)
{
if ($get_largest<$array[$i])
{$get_largest=$array[$i];
$get_largest=range(0,count($array));//I 'm not sure of this line
}
if ($get_smallest>$array[$i])
{
$get_smallest=$array[$i];
$get_smallest=range(0,count($array));
}
}
$largest_smallest=explode(',',$get_largest);
$smallest_largest=explode(' ,',$get_smallest);
// my code finished
echo "Largest to smallest: $largest_smallest\n";
echo "Smallest to largest: $smallest_largest\n";
?>