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
andi mitre
Treehouse Guest TeacherCode Challenge
This task has two steps. (1) Add the start of a foreach loop with an opening curly brace after the opening <ul> tag but before the first opening <li> tag. The foreach loop should load each element from the flavors array, one at a time, into another variable named flavor. (2) Add the closing curly brace for the foreach loop after the final closing </li> but before the closing </ul>.
<?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> { foreach ($flavors as $flavor) echo $flavor;
<li><?php echo $flavor; ?></li>
<li><?php echo $flavor; ?></li>
<li><?php echo $flavor; ?></li>
}
</ul>
What am I doing wrong?