Foreach loop in PHP
foreach loop
The foreach loop traverses each element of the array once. This loop is used only with array.
Syntax :
foreach($array as $variable)
Example:
<?php
$myfruits = ["Apple","Banana","Mango"];
foreach($myfruits as $item)
{
echo $item."\t";
}
?>
Output for the above code : Apple Banana Mango