Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Build a Simple PHP Application Listing Inventory Items More Excitement With Arrays

Matthew Pierce
Matthew Pierce
15,779 Points

Cannot pass task seven of Flavors Array code challenge

I cannot pass the final task for the flavors array challenge, as when I add "Cookie Dough" to the end of the array I receive the error that "Task 6 no longer passes". As task 6 requires there to be only 3 elements in the flavors array, I can delete the fourth element and it will pass, but then of course task 7 does not.

Any ideas?

<?php

    $flavors = array("Chocolate", "Vanilla", "Strawberry", "Cookie Dough");
?>
<p>Welcome to Ye Olde Ice Cream Shoppe. We sell <?php echo count($flavors); ?> flavors of ice cream.</p>
<ul>
   <?php foreach($flavors as $flavor){ ?>
  <li><?php echo $flavor ?></li>
  <?php } ?>
</ul>

2 Answers

Can we see your code? Might get a better idea.

Matthew Pierce
Matthew Pierce
15,779 Points

I started the challenge from the beginning and used the same code as I had previously, however this time I was able to pass Task 7 and complete the challenge. Weird!

Code has been added to the original post.

Exactly what I had, and it passed. Maybe a stray character somewhere or it was sending some cached version that was failing.