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

For Loops in PHP Forum

View Course » View Exercise

555 points
51315408c3f3d809eb001060_425868639
Submitted by
Doesn't Matter
about 4 years ago

Whats wrong with my code

I THINK im doing this right but uh Codecademy says otherwise so... someone please fix my code.<html>
<head>
<title>Solo For Loop!</title>
</head>
<body>
<p>
<?php
// Write your for loop below!
for ($i=0; $i < 110; $i=$i+10;$i=50; $i > 0;$i=$i-5;) {
echo $i;
}
?>
</p>
</body>
</html>

BTW it says "Oops, try again! It looks like nothing was echoed!"


2 votes

permalink

You have too many parameters, you should only have one set of 3 in a for loop. Remove the semicolon after the last part as well.

628 points
504d55a521717700020088da_387798498
Submitted by
Timothy Trageser
about 4 years ago

1 Comment

F0f59a6c22fa1a8774366a4d9cf17e6b?s=140&d=retro tahareal almost 4 years ago

remove all this ";$i=50; $i > 0;$i=$i-5;" and change the "echo $i;" to "echo $i "