This forum is now read-only. Please use our new forums at discuss.codecademy.com.

For Loops in PHP Forum

View Course » View Exercise

585 points
628683b60c9ef29a80523d27dc8127a0?s=140&d=retro
Submitted by
Jimmy Pants
about 4 years ago

INFO: There is a bug in this module that may be frustrating you.

When the page loads, after about a minute or two (I didn't time it), it pops up a message about the program taking too long to run and to check that you didn't put an infinite loop in your code. After this pops up, you can't submit your code.

The solution is to copy all your code, reload the page, select all, and paste in the good code before the bug has has a chance to pop up the window. 1.4, at least, has the same problem and solution.


12 votes

permalink

thanks for the info tho...I was getting tired of this as well

853 points
0d6e7cc4480e3ab538e6e3795d398613?s=140&d=retro
Submitted by
codemonkey1388_51f70442282ae3ac0f000
about 4 years ago

3 Comments

628683b60c9ef29a80523d27dc8127a0?s=140&d=retro Jimmy Pants about 4 years ago

I notice they actually mention this explicitly a couple of problems later, but when it happens the first few times you are only told it will happen by implication.

628683b60c9ef29a80523d27dc8127a0?s=140&d=retro Jimmy Pants about 4 years ago

... so technically, it's not a bug - I believe that while typing in the conditions for the while loop, its dynamic interpretation grabs onto some part of your formula that it interprets as it if were the whole formula, and then tries to show the result of that infinite loop in the preview window (same process that makes all your html code display as you go). I'm just speculating, natch - I'm a student. But I'm pretty sure the code of the site itself is bug-free and works exactly as intended. Just not completely, what's the wrod... robust. :>

50cb716d08c5ab99a9000349_847632252 Paul Kelley almost 4 years ago

I'm so thankful for these forums!


1 vote

permalink

This solution did not work for me.

105 points
Picture
Submitted by
Shawn Nelson
almost 4 years ago


0 votes

permalink

i noticed, i couldnt figure out the bug

for ($i = 10; $i < 101; $i = $i + 10) {
echo $i;
}

702 points
920bba59c60f7d7a377cc79470eea3ba?s=140&d=retro
Submitted by
oetze van den broek
about 4 years ago

2 Comments

521f5214f10c6076a9003864_374348215 DON almost 4 years ago

you also might want to try this.
<?php
for ($i = 10; $i <= 100; $i=$i+10) {
echo $i;

521f5214f10c6076a9003864_374348215 DON almost 4 years ago

see the difference!!!


0 votes

permalink

Thanks so much for posting this. I knew my code was right (even copy pasted the for loop from the previous section to double check). Copied my code, reloaded the page, pasted it back in and hit submit and it all went swimmingly.

Pretty sure Jimmy Pants is right about why it happens. The thing is, in the Javascript track, they managed to avoid this problem pretty easily, so why didn't they do the same thing here?

868 points
52338d2a548c351bbb001e18_699980846
Submitted by
Wolvenna
about 4 years ago


0 votes

permalink

thank you! this was driving me nuts

303 points
Picture
Submitted by
Devan Walia
almost 4 years ago


0 votes

permalink

Chiming in another casual "thanks" for your heroism, sir. Man, without these forums, I would have been stuck so many times in inconvenient places. :<

871 points
524ed15b548c35581b004bb2_103798937
Submitted by
dmboogie
almost 4 years ago


0 votes

permalink

It worked for me! Tnx!

639 points
1166318288a9075f41e8070790883e4d?s=140&d=retro
Submitted by
Morzana
almost 3 years ago


0 votes

permalink

I encountered this same issue, and none of the solutions in this message worked for me. I advanced the lesson to 4/7 using the drop down menu. I was able to paste my code there, and checked the results in the output.

715 points
2f2d6d18a5bc77bc6b4b55cc9584dc93?s=140&d=retro
Submitted by
M_V_093_tim
about 2 years ago