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 trialA X
12,842 PointsNot Understanding What a Multi-Dimensional Array is or What it does.
To me, what Alena typed as an example of a multi-dimensional array looks like a normal array with string associations inside it. I don't understand what makes it "multi-dimensional" in nature. Thanks for clarifying!
4 Answers
Ken Stone
29,703 PointsTry to think of it as rows and columns in a table. $array[row][col]
Also it could be considered an array of arrays.
A one dimensional array is probably what you learned first $array[index]
A two or multidimensional array is an array of one dimensional arrays.
Emil Pesaxov
3,684 PointsHi everybody, if you guys have some basic knowledge in HTML then the best way to understand Multi-Dimensional Arrays would be to think of them as an <ol> or <ul> that consists of list items <li> and a list item can be another list that consists other list items within it, ad infinitum.
A multi-dimensional array is basically an array that holds as it's elements associative arrays when each array has a numeric index. So $myList[0] will bring the first associative array as the first element of the outside array.
Hope this helps someone. :)
Katiuska Alicea de Leon
10,341 PointsI think I just don't understand Alena :'(
A X
12,842 PointsA X
12,842 Points@Ken Stone Ah ok, so a 3 dimensional array would be like the x, y, and z coordinates on a graph then?