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 PHP Arrays and Control Structures PHP Arrays Multidimensional Arrays

Stuck on PHP Array Challenge 1

I don't seem to understand the question. Every array I try tells me I need another "array()" for each person. Should I leave the simple array $contacts intact and create new arrays? Or, reconstruct $contacts to fit the requirements of the "first step" as outlined in the question? Is the key 'name' required in the completion of this challenge? Any more details as to how the answer should be structured would be helpful.

1 Answer

Hi Scott,

Right now, the $contacts array is a simple array of 4 strings. Task 1 wants you to replace each of those strings with a new array where the key is "name" and the teacher's name is the value at that key.

For example, Alena's array would look like this:

array("name" => 'Alena Holligan')

Each teacher's name is getting replaced with an array like that.

Let me know if you're still stuck.

Thank you for your response!

Yes, this is one thing I tried, except I was making individual arrays for each person instead of creating another array inside of $contacts ("an internal array").

This helped! Thank you, again.