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

Insert Element in the middle of stacked Array

Hello, I have following Array, and I want to add the Library Items automatically by a for-each loop. How can I do that?

Unfortunately I don'T get how to do the corrects code-highlighting, here you have a pastebin link: http://pastebin.com/pbKcZXkF

Tim, can you post the foreach loop that you have now? Also, can you explain the problem a little more? How are you generating the $primary_nav array? Why is the Library item being added after the array's creation?

Tim,

This thread will show you how to do the code: https://teamtreehouse.com/forum/posting-code-to-the-forum