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

Kris Tryber
10,416 PointsMore Excitement With Arrays 7/7 issue
Hey everyone,
I seem to have hit a roadblock during some of Randy's php code challenges.
<?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; ?> <?php } ?></li>
</ul>
More Excitement With Arrays 7/7
This one should have been the easiest in my opinion, add another flavor and everything updates.
So I add Randy's favorite flavor, Cookie Dough and this is my preview output.
Welcome to Ye Olde Ice Cream Shoppe. We sell 4 flavors of ice cream.
Chocolate
Vanilla
Strawberry
Cookie Dough
However I cannot seem to get this right....
Bummer! The unordered list should have exactly four items in it.
Any help would be appreciated.
Kris
3 Answers

samiff
31,206 PointsYour closing </li>
bracket needs to go inside of the last curly bracket closing the foreach loop.
Also, here's another way to format the code which might be less messy:
<?php
$flavors = array('Chocolate', 'Vanilla', 'Cheesecake', '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)
{
echo "<li> $flavor </li>";
}
?>
</ul>

Kris Tryber
10,416 PointsSam,
Thanks man you rock. rookie mistake!!
Kris

Robbie Thomas
31,093 PointsI forgot that you had to add "count($flavors)" to it myself.