php - Something wrong with this for loop -
I have this loop which does not do the right thing and I will thank you very much if you tell me where the problem is here :
$ num_rows = 3; Echo '& lt; Div id = "slideshow" & gt; & Lt; div & gt; '; ($ I = 0; $ i & lt; $ num_rows; $ i ++) for {echo '& lt; Div class = "" & gt; Text & lt; / Div & gt; '; If (($ i + 1)% 1 == 0) echo ' The problem is that it pulls another empty div. The result is:
& lt; Div & gt; & Lt; div class = "" & gt; Text & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div & gt; & Lt; Div class = "" & gt; Text & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div & gt; & Lt; Div class = "" & gt; Text & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div & gt; & Lt; / Div & gt; Why is that so? Thanks for your help!
The problem with your code is given below:
$ NUM_ROWS = 3; Echo '& lt; Div id = "slideshow" & gt; & Lt; div & gt; '; ($ I = 0; $ i & lt; $ num_rows; $ i ++) for {echo '& lt; div class = "" & gt; Text & lt; / Div & gt; '; If (($ i + 1)% 1 == 0) echo ' After removing them, your code should be down:
$ num_rows = 3; Echo '& lt; Div id = "slideshow" & gt; & Lt; div & gt; '; ($ I = 0; $ i & lt; $ num_rows; $ i ++) for {echo '& lt; div class = "" & gt; Text & lt; / Div & gt; '; If (($ i + 1)% 1 == 0) echo ' As you were making an empty bi myself, hope that it helps.
Comments
Post a Comment