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


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 ;)