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!
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

Steven Horan
6,647 PointsPHP Listing Inventory Items: Code Challenge: More Excitement With Arrays (4 of 7 ) Not recognizing correct answer
Bummer! The page is not displaying the correct number of flavors; it should say we have 3 flavors.
code: <?php $flavors = array(); $flavors[] = "Chocolate"; $flavors[] = "Vanilla"; $flavors[] = "Peppermint"; ?> <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>
4 Answers

Tyler Wendlandt
4,267 PointsI just reran through the question, and used <?php echo count($flavors) ?> and it worked fine. I see that you have jumped a few steps and already displayed the list of flavors. Maybe that is causing the issue, I'm not sure though. try the challenge without jumping ahead and see if it works for you.

Randy Hoyt
Treehouse Guest TeacherHmmm ... I think the issues is that you have too many spaces between the number and the word flavors. The code challenge is looking for this ...
3 flavors
... but I think you have this (with two spaces):
3 flavors
That extra space probably shouldn't matter; the browser won't display two spaces together like that. I'll see what I can do to get that fixed, but hopefully you can get passed that by removing the extra space.

Harvey Clear
3,025 PointsI'm also having this issue
<?php
$flavors = array ("Chocolate", "Vanilla", "Dog Food");
?> <p>Welcome to Ye Olde Ice Cream Shoppe. We sell <?php echo count($flavors); ?> flavors of ice cream.</p> <ul> <li><?php echo $flavor1; ?></li> <li><?php echo $flavor2; ?></li> </ul>

Harvey Clear
3,025 Pointsstarted again and used the same answers and it worked.. frustrating..