Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
Multidimensional arrays allow me to create an nested array of information for each item in my list. In this video we'll take a look at the format for creating multidimensional arrays.
In a multidimensional array, a key in the outer array contains a secondary inner array. Multidimensional arrays may have indexed or named keys.
Example
$task1 = array(
'title' => 'Laundry',
'priority' => 2,
'due' => '',
'complete' => true,
);
$taskList = array($task1);
$taskNames['Task 1'] = $task1;
In the code above $taskList[0]['title'], $taskNames['Task 1']['title'] and $task1['title'] all return 'Laundry'.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up