For Loop tutorial confusion


#1


"Oops, try again. It looks like your loop didn't echo 'The 50..."


<html>
  <head>
    <title></title>
  </head>
  <body>
    <p>
      <?php
        $yardlines = array("The 50...", "the 40... ",
        "the 30... ", "the 20... ", "the 10... ");
        foreach ($yardlines as $item) {
              echo "<li>$item</li>";
        }
        echo "touchdown!";
      ?>
    </p>
  </body>
</html>

Output on console

The 50...the 40... the 30... the 20... the 10... touchdown!


#2

Solved with using

echo "<p>$item</p>";

Seems buggy


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.