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.


Trevor Wood
Trevor Wood
17,828 Points

Question on arrays problem.

I'm not exactly sure what to do on this problem. Can someone give me an example of what needs to be done or something like that? Here's the link

1 Answer

Gerasimos Kourtidis
Gerasimos Kourtidis
5,162 Points

you have to get the key of the element in each iteration to do so you just add another variable in the loop which will represent the key of the element something like this : foreach($words as $id => $word) so now inside the loop you could access two variables of that element... the key and the value I hope it helps ;)