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

For Loops in PHP Forum

View Course » View Exercise

299 points
53ef0fc97c82ca1381000af4_96720830
Submitted by
mudkip123
almost 3 years ago

what is wrong with my code

this is my code:
<?php
for ($i = 10; $i < 11; $i++) {
echo $i;
?>
and in the output box it says: Parse error: syntax error, unexpected $end on line 15. what is wrong?


1 vote

permalink

Do this:                             Add " " .

for ($i = 10; $i < 101; $i = $i + "" . 10) {
echo $i;
}
Then just erase that part, glitch went away for me.

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

1122 points
A14d4359136d17c73405447e23bedda3?s=140&d=retro
Submitted by
tortuga7667_54d846ac937676015f008492
almost 3 years ago


0 votes

permalink

You forgot to use closing brackets for the for loop!

<?php
for ($i = 10; $i < 11; $i++) {
echo $i;
}
?>

56 points
Picture
Submitted by
Gregory van den Ende
almost 3 years ago


0 votes

permalink

  1. Refresh your page
  2. add <p>$i</p> to your echo

470 points
58207af658212236be000218_927420896
Submitted by
Eric Xu
almost 3 years ago