PHP Programs

Please click on 1-2 Ads to keep this website's Study Material FREE and regularly Updated.

Program 39: Write a program to print the largest element present in an array.


<!DOCTYPE html>  
	<title>PHP Programs</title>
		$arr = array(255, 101, 987, 715, 506);   
		$maximum = $arr[0];  
		for ($i = 0; $i < count($arr); $i++) 
			if($arr[$i] > $maximum)  
			$maximum = $arr[$i];  

		print("Largest element present in given array: " . $maximum);

If you have any suggestion or found any error in the above program, then do let us know at [email protected] or just comment below.