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!

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

These instructions are not clear

"Right now, the text shows the wrong letters; we want it to display my real favorite letters from the array. In the next few tasks, we’ll change that. This task has two steps. (1) Add the start of a foreach loop with an opening curly brace between the third and fourth echo commands. The foreach loop should load each element from the letters array, one at a time, into a working variable named letter. (2) Add the closing curly brace for the foreach loop between the fourth and fifth echo commands. (Leave the letters AB in the fourth echo command for now. At the end of this step, the page should say my favorite letters are ABABAB.)"

How can code be written between "the third and fourth echo commands"? It will either be on line 3 or it will be on line 4.

This is the code that I have written after trying very hard to follow all of the previous steps in the instructions given to me. It works, but obviously isn't what Treehouse is looking for. Where have I gone wrong??? PS IF I had a copy of the correct code, I wouldn't have to be spending time asking a question on this forum, but could immediately see what it is that you guys are looking for and move on.

2 Answers

When instructions say fourth or fifth, I believe they are not speaking about the line numbers..

Go ahead and add new lines so that your for each loop contains the echo ab command.

Thanks Leonardo, I see how to do it now.