7/7 error


#1

i dont know what is this is not working. my code

<html>
  <head>
    <title></title>
  </head>
  <body>
    <p>
      <?php
        $yardlines = array("The 50... ", "the 40... ",
        "the 30... ", "the 20... ", "the 10... ");
        // Write your foreach loop below this line
        fforeach ($yardlines as $lines) {
            echo $lines;
        
        
        // Write your foreach loop above this line
        echo "$touchdown!"
        
        unset($yardlines);
        }
      ?>
    </p>
  </body>
</html>

i am getting this as an error " Oops, try again. It looks like your loop didn't echo 'The 50...'.
how do i fix this
thanks


#2

You have a typing mistake there. Can you see that now?

  • As in the real game, you yell "touchdown!", without the "$".
  • Also, you yell it after you get to the end zone, not at every yard line.

That is wiping out your $yardlines array after the first loop.


#3

thanks for the help hopefully i can get this working


#4

Just ask if anything seems mysterious.


#10

<html>

<head>
     <title></title>
   </head>
  <body>
     <p>
       <?php
         $yardlines = array("The 50... ", "the 40... ",
         "the 30... ", "the 20... ", "the 10... ");
        // Write your foreach loop below this line
        foreach ($yardlines as $lines) {
            echo $lines;
         
        
         // Write your foreach loop above this line
         echo "touchdown!"
        
         }
       ?>
     </p>
   </body>
 </html>

This is my code and I am getting the same error.


#11

When I run your code, I get an error about a missing semicolon. Are you seeing that?


#12

I get the same error, except that my output does show "The 50... ". Any idea what's going on?


#13

I haven't tested but I bet all those ! are not what the code checker is looking for.


#14

Thanks albionsrefuge. I tried double quotes as well, but will try them again.


#15

Just tried it again. That's not the reason. :disappointed:


#16

I've finally gotten a chance to do some testing and I've found out that the code checker isn't happy with those <li>tags. I found that you can instead put <br> tags at the end of each line and it is okay with that.


#17

Yeyyy, awesome! Thank you. :slight_smile: