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

General Discussion

Simple PHP Application Stage 4 More excitement with Arrays challenge 6/7

QUESTION Inside the foreach loop, we should only display one <li> tag for each flavor. The one list item should display the value for the array element that the foreach loop is considering. Remove one of the <li> elements, and change the value that gets displayed in the other to display the flavor.


$flavors = array("Chocolate","Vanilla", "Strawberry")

?> <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> echo $flavor</li> <? } ?> </ul>

I have tried a million different things please help

2 Answers

Coco Jackowski
Coco Jackowski
12,914 Points

I haven't done this challenge, but the question does mention displaying list item (<li>) tags. Your code simply echos out the flavor values, not inside any HTML tags. Maybe if you echo out the values inside of <li> tags it will be correct?

i had it in the <li> tags didnt work, but i didnt but HTML tags but it wasnt a problem for the last 5 before it