0
<?php $names = array("John", "David", "Amy"); foreach ($names as $name) { echo $name.'<br />'; } ?>.
In this question foreach($names as $name)
1 Antwort
+ 8
Rajat Khatore hi,
In this foreach loop executes as many times as there are values in the given array ($names). Each time it's run it stores the current value in the given variable ($name). $name can then be used inside the foreach-block.
Also, $name is probably read-only which is used for reading the name present in the $names array.