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

For Loops in PHP Forum

View Course » View Exercise

214 points
512a5f64b287b420b30063c7_188600715
Submitted by
kray7_512672ddee6d279ef300042a_delet
over 4 years ago

I keep getting the right output, just won't pass.

This is my code, but it won't pass even though I get the right output. Is there a formatting issue or something?

Solo For Loop!



<?php
// Write your for loop below!
for($loop=50; $loop>=5; $loop=$loop-5) {
echo $loop;
}
?>


7 votes

permalink

instead of - 5 you must use -= 5

595 points
0a227c8dd4bf069eb23e7d2da599cabf?s=140&d=retro
Submitted by
ryan23456789
over 4 years ago

4 Comments

Picture Matt Atkinson over 4 years ago

What in the world, that worked. Is it a bug?

4fe4baa21d51b20e142d6d12fe241cc1?s=140&d=retro Jacob Ajjarapu over 4 years ago

Worked for me also. Why must you use -= 5?

510075f4a5aa3fbce60001fe_660399124 Paul over 4 years ago

The hint is wrong. This has been the case with a few of the PHP sections! @CodeAcademy - please fix your hints! BTW, I'm using Firefox (latest) and Chrome...

51f013149c4e9dfa36005ee3_403547752 Pazzo over 3 years ago

After being stuck on that one for almost three days. Thank You, Now i'm not exactly sure if i can do Loops without relying on a message board. JK
(Using FireFox 26.0)


1 vote

permalink

Matt Atkinson yes that did work, don't know why but it did. Also thank you ryan.

214 points
512a5f64b287b420b30063c7_188600715
Submitted by
kray7_512672ddee6d279ef300042a_delet
over 4 years ago


0 votes

permalink

I don't know why it works but it's probably a bug

595 points
0a227c8dd4bf069eb23e7d2da599cabf?s=140&d=retro
Submitted by
ryan23456789
over 4 years ago