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

For Loops in PHP Forum

View Course » View Exercise

867 points
Submitted by
Ibrahim Ismail
about 4 years ago

All on Your Own!

So I typed

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

    // Write your foreach loop above this line
    echo $touchdown;
And it prints the whole thing but it keeps saying:
'Oops, try again! It looks like your loop didn't echo 'the 10...'

3 votes


Hi Ibrahim;
What you need to do is add, 'echo $touchdown!' within the curly braces (or whatever you wish to assign/call "$yardlines"). This tells the loop you want it to go through each element in the array, print the result on screen and stop there; by moving the curly braces at the bottom of the second "touchdown!" to it.

Now, you need type nothing more, the code is complete. Just run it!!
This is what you're doing; You're telling the computer to go the first, 'touchdown' array and print it on screen. Afterwards, just print the string, "touchdown!".

564 points
Submitted by
about 4 years ago


52bf57d9631fe9217d002e32_750892378 Ibrahim Ismail about 4 years ago

Thanks for the explanation! Here's a 1 up!

52eaed6752f86324400008c4_751627060 yodudo almost 4 years ago

make that 2 up

1 vote


Same here!! I'm still confused! ;-S

854 points
Submitted by
about 4 years ago