/* */ Click to Join Live Class with Shankar sir Call 9798158723

PHP nested for loop ?


Loop inside a loop is called nested for loop.

Syntax:-

for(exp 1; exp 2; exp 3)
{
for (exp1; exp2; exp3)
{
statement …………………
}
}

Q.) W.A.P to print 123 three times using nested for loop.
 <html>
 <body>
 <?php 
 for($i = 1; $i <=3 ; $i++)
 {
 for($j=1;$j<=3;$j++)
 {
 echo $j;
 }
 echo “<br>”;
 }
 ?>
 </body>
 </html>
Output
123
123
123