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

For Loops in PHP Forum

View Course » View Exercise

381 points
Fecf453df2b466452761deab74e60ed2?s=140&d=retro
Submitted by
knitedog73
almost 4 years ago

Why won't this work?

<?php
$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;
    }
  ?>

2 votes

permalink

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

    // Write your foreach loop above this line
    echo "touchdown!";

need "echo "tochdown!";

869 points
525bf6d080ff3382cb005e5a_950403995
Submitted by
ǝuıʇuǝlɐʌ ɐıʌ
almost 4 years ago

1 Comment

5233fb9680ff3344b5002e83_891682010 Shane Stouts almost 4 years ago

agreed. you echo touchdown outside of the loop.