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
An array is a compound variable type meaning it can contain more than one value. We'll start with a basic indexed array, which can be used as a list of items: shopping list, days of the week, the top ten scores in a game, or a todo list.
Documentation
Arrays in PHP are actually ordered maps. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. As array values can be other arrays, trees and multidimensional arrays are also possible.
See more about the Function for Creating Arrays
Shortcut for Assigning Values
Leave off the array keyword and use square brackets instead.
$learn = ['Conditionals', 'Arrays', 'Loops'];
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