DWPD-3.2: Write PHP Script to demonstrate use of associative arrays for FOR EACH loop execution.

foreach loop
Lab # 3
FUNCTIONS


2. Write PHP Script to demonstrate use of associative arrays for FOR EACH loop execution.

Lab-3-2-foreach.php

<?php
$name=array('one'=>'John',
'two'=>'Jane',
'three'=>'marry',
'four'=>'sam');

foreach($name as $values){
echo $values.'<br>';
}
?>


Output

foreach loop in php output
foreach loop in php by Practical Server



Happy Coding 🙂

Leave a comment