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

Gurveer Singh
Gurveer Singh
11,369 Points

PHP array

$arrayf = array('name' => 'Alena Holligan', 'email' => 'alena.holligan@teamtreehouse.com'); $arrays = array('name' => 'Dave McFarland', 'email' => 'dave.mcfarland@teamtreehouse.com'); $arrayt = array('name' => 'Treasure Porth', 'email' => 'treasure.porth@teamtreehouse.com'); $arrayf = array('name' => 'Andrew Chalkley', 'email' => 'andrew.chalkley@teamtreehouse.com');

$contacts = array($arrayf, $arrays, $arrayt, $arrayf);

var_dump($contacts);

index.php
<?php
//edit this array



//$contacts[0] will return 'Alena Holligan' in our simple array of names.
$arrayf = array('name' => 'Alena Holligan',
                'email' => 'alena.holligan@teamtreehouse.com');
$arrays = array('name' => 'Dave McFarland', 
                'email' => 'dave.mcfarland@teamtreehouse.com');
$arrayt = array('name' => 'Treasure Porth', 
                'email' => 'treasure.porth@teamtreehouse.com');
$arrayf = array('name' => 'Andrew Chalkley',
                 'email' => 'andrew.chalkley@teamtreehouse.com');

$contacts = array($arrayf, $arrays, $arrayt, $arrayf);

var_dump($contacts);

Could you explain what you are trying to accomplish? Based on the note above your code, the task just to create an array which stores the string, 'Alena Holligan', as its first value.

1 Answer

Amber Stevens
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Amber Stevens
Treehouse Project Reviewer

Gurveer Singh I'm not sure what your question is because you didn't ask one. I can however tell you that you have two different $arrayf arrays and the second one (the Andrew Chalkley one) will overwrite the first (the Alena Holligan one)