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

For Loops in PHP Forum

View Course » View Exercise

405 points
B9b4af7d293f8c94db1d696f5a21fc1e?s=140&d=retro
Submitted by
D. Philpot
almost 4 years ago

SOLUTION!!!

for ($i = 50; $i >= 5; $i = $i - 5) {
echo $i;
}

This is my code, exactly what Codecademy helped us learn. What i had to do to get it to pass was copy my code, leave the space after "// write for loop below" blank, press save and submit (blank), refresh my page, paste my (above) code, press save and submit! done

{same thing for previous lesson 1.3}


1 vote

permalink

I guess this will work:
for ($i = 51; $i < 4; $i =$i -5) {
echo $i;
}

1008 points
51306991d089e483a100728b_480979936
Submitted by
Omar Zaffar Khan
almost 4 years ago

5 Comments

51306991d089e483a100728b_480979936 Omar Zaffar Khan almost 4 years ago

Did it work?

51306991d089e483a100728b_480979936 Omar Zaffar Khan almost 4 years ago

OR for ($i = 51; $i < 4; $i =$i -5) {
echo $i;
}

51306991d089e483a100728b_480979936 Omar Zaffar Khan almost 4 years ago

did the second formula work?

525093fdf10c60696a0047b1_310886792 themecomet almost 4 years ago

Both formula's didn't work

B9b4af7d293f8c94db1d696f5a21fc1e?s=140&d=retro D. Philpot almost 4 years ago

just copy n paste exactly what i have and follow what i wrote then it will pass


1 vote

permalink

This works. But all this is quite a pain...

214 points
09af059a4a9c8a77988c1248033a1e17?s=140&d=retro
Submitted by
Suedo
over 3 years ago


1 vote

permalink

The easiest way to finish these (1.3,1.4) is to alternate putting a space between the curly brace and the parentheses and deleting the space. No space works on 1.3 and one space works on 1.4.

1970 points
501bf5bd0a4630000203ea40_415622017
Submitted by
Joshua Marsden
over 3 years ago


1 vote

permalink

<?php

for($i = 50; $i >= 5; $i=$i-5)
{

       echo $i;
  };
 ?>

Try this

448 points
52c02aa3282ae3017f004b97_859899074
Submitted by
Chiranjeevi Pippalla
over 3 years ago