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 trialGurveer Singh
10,202 PointsPHP 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);
<?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);
1 Answer
Amber Stevens
Treehouse Project ReviewerGurveer 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)
Eric Drake
6,339 PointsEric Drake
6,339 PointsCould 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.