gabriel wambua5,058 Points
What am I doing wrong?
I felt for sure that this code would work. I am however getting an error telling me that there should only be 2 levels of arrays. The main array and 4 other arrays set inside the main array.
The code looks sound. What am I doing wrong?
<?php $contacts = array( "alena"=>array( 'name'=> 'Alena Holigan', 'email'=>'email@example.com' ), "dave"=>array( 'name'=> 'Dave McFarland', 'email'=>'firstname.lastname@example.org' ), "Treasure"=>array( 'name'=> 'Treasure Porth', 'email'=>'email@example.com' ), "Andrew"=>array( 'name'=> 'Andrew Chalkle', 'email'=>'firstname.lastname@example.org' ));
Jennifer NordellTreehouse Staff
Hi there, gabriel wambua ! Looks like you're off to a terrific start, but that's not quite what they're asking for. First, you are assigning everything to the 0 index of
$contacts, but each index of
$contacts should be an array. Secondly, you're providing a key that isn't being asked for. Third, on Andrew Chalkley's name you have a misspelling of their name and also on Alena Holligan. Let's take a look at how I might start that array, which is actually very similar to your code:
<?php $contacts = array( array( 'name'=> 'Alena Holligan', 'email'=>'email@example.com' ),
Continue in this pattern, but check again the spelling of "Alena Holigan" which is what you have vs "Alena Holligan" and "Andrew Chalkle" (your version) and "Andrew Chalkley" (the correct spelling).
Hope this helps!