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

For Loops in PHP Forum

View Course » View Exercise

782 points
E2d1f81266d7d7018e1eb5ffe4b252c8?s=140&d=retro
Submitted by
Peter Kang
almost 4 years ago

What am I doing wrong with my "echo"?

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

    foreach ($yardlines as $yardline) {
        echo "<li>$yardline</li>";
    }
    unset($yardline);

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

0 votes

permalink

But it works on my pc.

675 points
52205001f10c604a1b001776_776985269
Submitted by
superbear
almost 4 years ago


0 votes

permalink

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

    foreach($yardlines as $a){
        echo $a;
    }
    // Write your foreach loop above this line
    echo "touchdown!";
  ?>

561 points
2b28061ae578cc673eee3d1644edd681?s=140&d=retro
Submitted by
nusret
almost 4 years ago