programming-examples/php/Basics/PHP Program for finding the biggest number in an array without using any array functions.php

15 lines
377 B
PHP
Raw Permalink Normal View History

2019-11-18 14:44:36 +01:00
// Write a Program for finding the biggest number in an array without using any array functions.
<?php
$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;
?>