Contact US


Get Your Project Done by our experts
info@fundaofwebit.com

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

$student = ["Narendra","Prakash","Lakshmi"];

foreach($student as $row)
{
    echo $row."\t";
}

?>


Output for the above code : Narendra Prakash Lakshmi