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

For Loops in PHP Forum

View Course » View Exercise

154 points
5431528b9c4e9df3aa0052b2_958549936
Submitted by
toofig
almost 3 years ago

7/7 All on your own, does not save...

Hi guys, I have just written this 7/7 all on your own, foreach loop, but it just wont go on.

I have tried many different types, styles,e tc... but no luck. anybody has a definit way to pass this ?

I do not have any errors in the right up screen, it shows the echoed info " the10..." and even with a touchdown. but I get error while saving, it says I forgot {}, then sometimes it says tha "the 10... was not echoed, that's not true, all works fine.
please help.


8 votes

permalink

Mine worked out fine, like this. ( Browser safari)

<?php
$yardlines = array("The 50... ", "the 40... ",
"the 30... ", "the 20... ", "the 10... ");
// Write your foreach loop below this line

    foreach($yardlines as $item) {
        echo $item;
    }

    // Write your foreach loop above this line
    echo "touchdown!";
  ?>
</p>

272 points
C4cafd8df7acb5079662e9c8017bb5ff?s=140&d=retro
Submitted by
Raven Picturez
almost 3 years ago

1 Comment

54557efd9c4e9d4094002ef7_575393179 Lisa Jackie Grima almost 3 years ago

Thanks! This totally worked :) I'm thru!


0 votes

permalink

Same for me. Very very disappointing!

114 points
2517aa0e34aa6faba3de654d589ec5e2?s=140&d=retro
Submitted by
codes55555
almost 3 years ago


0 votes

permalink

I am getting the same i've been stuck for hours... the hint does not help much

360 points
543af44e52f86370ad00053e_211904298
Submitted by
Juan
almost 3 years ago


0 votes

permalink

I guess we have arrived at a sleeping project website :) nobody is watching over us ...
I have seen this kind of thing happening all the time from the start, even when the code is right but not it the same way as they want, then it would give errors. I have even had once \that if I just close bracket a rule further, then it will giver error, while that's not a problem normally.

154 points
5431528b9c4e9df3aa0052b2_958549936
Submitted by
toofig
almost 3 years ago

1 Comment

E39786f437da6f566327b05ebf08c600?s=140&d=retro akash almost 3 years ago

calm down put echo "touchdown!"; after ending foreach loop . it works fine . dont interfere with their code . just do what they say


0 votes

permalink

i am going to live it for tomorrow with a fresh mind, I am getting tunnel vision

360 points
543af44e52f86370ad00053e_211904298
Submitted by
Juan
almost 3 years ago


0 votes

permalink

solved :

It's a browser problem, I have done my code in the IE (without plugins) and it works. also I can see that when I open next lesson, it shows totaly diferent in firefox then IE. there is something wrong with the browsers ways of handling the requests I gues... so everyone that is not passing it, use another browser.

154 points
5431528b9c4e9df3aa0052b2_958549936
Submitted by
toofig
almost 3 years ago


0 votes

permalink

There's definitely something wrong with this lesson. Another post gave the answer as

<?php
$yardlines = array("The 50... ", "the 40... ",
"the 30... ", "the 20... ", "the 10... ");
// Write your foreach loop below this line
foreach($yardlines as $item) {

    // Write your foreach loop above this line
    echo $item;
    echo "touchdown!";
    }
  ?>

The problem with this is that your message now says "The 50Touchdown" "The40Touchdown", which makes no sense. If this were a real program we're trying to run, it would be completely wrong.

The real answer should be either just "echo $item" and count down or just leave in "echo touchdown". If I'm way off, then something was skipped.

288 points
5c26c82839438838061e900b82d9b1e9?s=140&d=retro
Submitted by
Jay Albert
almost 3 years ago

1 Comment

51d135dd8c1cccb6aa00cf5a_557816372 dardan thaci almost 3 years ago

this worked for me, try it out!


-1 votes

permalink

put echo "touchdown!"; after ending foreach loop . it works fine . dont interfere with their code . just do what they say

194 points
E39786f437da6f566327b05ebf08c600?s=140&d=retro
Submitted by
akash
almost 3 years ago