Multipication table | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Multipication table

<?php for ($i= 1; $i <= 9; $i++) { for ($j=1 ;$j <= 9; $j++){ echo $i*$j . " "; } echo "</br>"; } ?> i don get how this work? Why the number didnt increase together ?

21st Jun 2018, 10:59 AM
Danish Lim
Danish Lim - avatar
2 Answers
0
this is nestead loop. internal loop of j will run each time for outer loop value of i. so when i is 1 j will run from 1 to 9. i=1,j=1 i=1, j=2 . . i=1,j=9 i=2,j=1 ....
21st Jun 2018, 12:27 PM
Sumesh
0
oh maybe i didnt learn yet thanks will check it out
21st Jun 2018, 2:17 PM
Danish Lim
Danish Lim - avatar