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

PHP Build a Simple PHP Application Listing Inventory Items Introducing Arrays

sebastian rojas
sebastian rojas
571 Points

Listing inventory items, stage 4 "challenge 6,7

Hey fellas! I'm having some hard time at Stage 4 "Listing Inventory Items" challenge task 6 of 7 but i would appreciate someone to help me with the whole code for 7 also

the code i have atm is

<?php

$letters = array("D", "G", "L"); echo "My favorite "; echo count($letters); echo " letters are these: "; foreach ($letters as $letter) { echo "AB"; } echo ".";

?>?>

Kind regards, Sebastian

2 Answers

At stage 6, it's a simple change. Instead of echoing "AB", you echo out $letter inside the foreach. As for stage 7, it's extremely simple, you just add another letter to the array.

sebastian rojas
sebastian rojas
571 Points

HAHAH, you are so right! It wasn't that hard i'm just tired and confused :D Big thanks to you Dino!

No problem, and good luck with the rest of the challenges. :)