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

For Loops in PHP Forum

View Course

504 points
55e3657b86f5524784000293_651492067
Submitted by
marsas.sp
about 2 years ago

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

I dont know what is happening...
My answer printed out touchdown five times.

touchdown!touchdown!touchdown!touchdown!touchdown!

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

      foreach( $yardlines as $i) {

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

ty.


0 votes

permalink

That's because echo "touchdown!" is inside the loop where it shouldn't be.

1288 points
Cd63ccf5369069002b667d4ebf703ac5?s=140&d=retro
Submitted by
sksn
about 2 years ago

1 Comment

55e3657b86f5524784000293_651492067 marsas.sp about 2 years ago

Ty ...sksn