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

For Loops in PHP Forum

View Course » View Exercise

47 points
85434a2a49ab01d0acab18a683f2d3b4?s=140&d=retro
Submitted by
gaelle60
over 3 years ago

What's wrong ? Thanks in advance

It looks like your loop didn't echo 'The 50... ' :

<?php
$yardlines = array("The 50... ", "the 40... ",
"the 30... ", "the 20... ", "the 10... ");
foreach ($yardlines as $touchdown){
echo "$touchdown!" ;
}
unset($touchdow);
?>


1 vote

permalink

The problems that I see are the you aren't calling $touchdown as a variable in your echo statement, but instead you've encased it in quotes as if it's a string. No quotes are needed on variables, because the quotes already exist for the variable as you added them to the variable already when you created it. You simply put

echo $touchdown;

Then, at the bottom, you'll need to change that probably to get the step passed and move on to the next. At the bottom of that particular step, it's not unset($touchdow); but rather it should be this:

echo "touchdown!";

That should fix you up!

965 points
510cf70685cb78845600421e_309033413
Submitted by
randy cramer
over 3 years ago

1 Comment

52a8c9b77c82ca1c0b0000cb_40780846 LLAMAMASTER23456 over 3 years ago

touchdow might also be your problem.