NextIndexPrevious

Programs in PHP

2. PHP array example.
<?php
	
	$arr = array(10,20,30);
	
    // to display array using print_r()
	
    print_r($arr);
    
    // to display array using foreach()
    
    foreach($arr as $v)
    {
    	echo "<br>".$v;
    }
	
?>
Output :

Array ( [0] => 10 [1] => 20 [2] => 30 )
10
20
30



Father of PHP

Rasmus Lerdorf

Rasmus Lerdorf

Born: November 22, 1968, Greenland