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 trialAlejandra Quezada
3,896 PointsHave you had trouble with loading correctly a challenge?
I'm having trouble with the challenge task 4 of 7 of "listing inventory items":
The paragraph in the HTML displays the number of flavors the store sells, but right now it always shows 2. Change the echo command in that paragraph to display the number of elements in the array.
It keeps showing an error and I can't even preview the result.
Has it happened to you?
4 Answers
Charlie O'Shea
18,737 PointsNone of the steps of this challenge would show in preview for me either, but previous challenges in this course did work with preview. It'd be great if this could be fixed for future users.
Christian Burgos
3,955 Points<?php
$flavors = array("Chocolate", "Vanilla", "Cheese");
?>
<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>
Alejandra Quezada
3,896 PointsThanks Preston,
I'm not having trouble with the code. I just mean I couldn't preview anything and don't know if that happens sometimes. The code was:
<?php
$flavors = array("Chocolate", "Vanilla", "Mint");
?> <p>Welcome to Ye Olde Ice Cream Shoppe. We sell <?php echo count ($flavors); ?> flavors of ice cream.</p>
Stone Preston
42,016 Pointsah I see. Im not sure if any of the PHP code challenges are meant to be previewed or not. I just tried it and it didnt work for me either
Alejandra Quezada
3,896 PointsOk, as far as I've experienced, they are... Thanks for the feedback
Stone Preston
42,016 PointsStone Preston
42,016 Pointscan you post the code you are using?