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.


<!DOCTYPE html>  
	<title>PHP Programs</title>
		$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>");  

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.