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

For Loops in PHP Forum

View Course » View Exercise

733 points
515e0c4d4490b74dcf0000ff_728751184
Submitted by
Jordan Andrews
about 4 years ago

Practicing with ForEach Issue

<?php
  $sentence = array("I'm ", "learning ", "PHP!");

  foreach ($sentence as $word) {
    echo $word;
  }
?>

When I try to submit this code, It gives me this error:

Oops, try again! It looks like nothing was echoed!

What should I do?


1 vote

permalink

Never mind. Apparently it worked now.

733 points
515e0c4d4490b74dcf0000ff_728751184
Submitted by
Jordan Andrews
about 4 years ago

1 Comment

53f3764e282ae3da53000455_587160470 Julijana Seketa almost 4 years ago

sometimes that happends on codecademy


1 vote

permalink

You see!!! it is " foreach"
<?php
$sentence = array("I'm ", "learning ", "PHP!");

    foreach($sentence as $word){
      echo $word;
    }
  ?>

289 points
51ac929e5e76ac0b38001ced_146756036
Submitted by
Montoo Mc
almost 4 years ago

1 Comment

5229d992f10c6095cd004150_747257615 Raahul Jaykar over 3 years ago

<?php
$sentence = array("I'm ", "learning ", "PHP!");

    foreach ($sentence as $word){
      echo $word;

    }
    ?>
</p>

this is the right answer


0 votes

permalink

I have the same problem.

757 points
E96ea5a4822c1f7868685cc1d3d37287?s=140&d=retro
Submitted by
yagtec
about 4 years ago


0 votes

permalink

ya it works

884 points
52a5c9df548c355247001428_819369585
Submitted by
anonymous
over 3 years ago