Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.

MY ANSWER <?php

$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