Suppose we have an array $numbers with some random numbers like below. Now we need to find the largest element of this array.
If you like this post don't forgot to leave a comment.
Chears :)
Happy coding
$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