PHP Programs

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

Program 38: Write a program to print the elements of an array present on odd position.

odd_position.php

<!DOCTYPE html>  
<html>
<head>	
	<title>PHP Programs TutorialDuniya.com</title>
</head>
<body>  
	<?php  
		$arr1 = array(10, 20, 30, 40, 50);   

		print("Elements of given array present on odd position: <br>");  
		for ($i = 1; $i < count($arr1); $i = $i+2) 
		{   
			print($arr1[$i] . "<br>");  
		} 
	?>  
</body>  
</html>



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.