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

For Loops in PHP Forum

View Course

410 points
55ff502d9113cbfe9b000626_131652678
Submitted by
Lindsay
about 2 years ago

Please fix the PHP course

I really want to finish the php course but the arrays and now for loops are not letting me submit!! I know the code is right because it is exactly the same as the example! Please, I am enjoying this and now have to start something else til this is fixed!


3 votes

permalink

I am having the exact same issue in the PHP course with for loops. From page 2 on I cannot submit the code ad move on to the next stage :( I have tried in different browsers and with 2 different laptops and a tablet, all with the same problem.

164 points
Picture
Submitted by
Michael Keeley
about 2 years ago


2 votes

permalink

Yes, I have to agree...the PHP tutorial is seriously flawed and needs work. I can't continue at this point after trying to clear out my cache and reloading the page so many times.

59 points
Bf9ae1cfd3d937ae5fef25ae1800d809?s=140&d=retro
Submitted by
Maximillian Heth
about 2 years ago


1 vote

permalink

I get an error saying it takes to long to finish the code... but i havent finished typing when that appears!!!!
Plz check that timer its annoying.

117 points
E62b18fbcfe9543e50b8e67a3355417e?s=140&d=retro
Submitted by
Therese Tjäder
about 2 years ago


1 vote

permalink

same issue, loops don't work. i've been trying over the last couple of days, but nothing has changed.

141 points
560986563e0ec8a90600010c_742167190
Submitted by
xelotar_5609861b51b88755af000149_del
about 2 years ago


0 votes

permalink

For anyone else who's having problems, I would definitely recommend checking out W3 Schools --> http://www.w3schools.com/php.

59 points
Bf9ae1cfd3d937ae5fef25ae1800d809?s=140&d=retro
Submitted by
Maximillian Heth
about 2 years ago


0 votes

permalink

Also having the same issue with for loops.

656 points
Aec4a5ca6e64c234890fbc4612a3ffa5?s=140&d=retro
Submitted by
wazojane
about 2 years ago


0 votes

permalink

Same problems here! Really annoying :(

271 points
8ffb55b2a3348dd719d373b0894da251?s=140&d=retro
Submitted by
chaton1990
about 2 years ago


0 votes

permalink

Folks, the way to get around this and the way that worked for me is to use a external text editor like notepad++ or Sublime Text to create your loop code and then when finished, copy & paste your code from the editor into the codecademy compiler.

It seems that the codecademy compiler is trying to compile your code before you have finished and this is possibly leading to infinite loops which is messing up the codecademy compiler.

You can also use this "php Sandbox" to test your code

hope this helps some.

164 points
Picture
Submitted by
Michael Keeley
about 2 years ago


0 votes

permalink

FYI, I finished the course up to 99% but am stuck on one task as it keeps throwing random errors whilst the code is correct and outputting exactly what is required * .

A lot of the time I copied the code, refreshed the page and pressed submit, which seems to work, but it shouldn't be necessary.

Another problem is that it seems to be checking for stuff like styling and giving out random errors when you try to submit like getting "your printed output for x should be an integer" whilst it is absolutely an integer.

  • I'm stuck on Functions, Part I 5/8, my code is: print rand(1,5); print ""; $name = "stefan"; $rand = rand(1,5); $result = substr("$name", "$rand", "1"); print $result;

I've ran this through phpcodechecker.com to be sure it was correct which it is.

The only thing I can imagine on what is wrong is that because I'm not using strlen it isn't going further on this one but heck it doesn't need it to complete the requirement nor does it give that as an error (it is saying the rand output is not an integer ... which it is lol).

If anyone has completed this part and has code for me to try out I'd be very grateful, I'd like to get the 100% completed mark :)

526 points
Picture
Submitted by
Stefan de Jong
about 2 years ago

1 Comment

Picture Michael Keeley about 2 years ago

Section 3 of the instructions tells you to use the "strlen" function. So as you did not use it it will not move you on. The tests are not to see how many other ways yo can complete the task, they are to see that you can complete the task in the manner specified using what you have learned in that and previous sections.

The only way you are going to get to 100% is by using the strlen function in your answer.