Write a program to find the biggest number in an array without using any array functions in PHP.

Suppose we have an array $numbers with some random numbers like below. Now we need to find the largest element of this array.


$numbers = array(12,23,45,20,5,6,34,17,9,56,999);
$length      = count($numbers);
$max         = $numbers[0];

for($i=1;$i<$length;$i++)
{
   if($numbers[$i]>$max)
    {
        $max=$numbers[$i];
    }
}

echo "The biggest number is ".$max;


If you like this post don't forgot to leave a comment.
Chears :)
Happy coding

Post a Comment

Previous Post Next Post