If you need to hold more than one item of data you can use more than one variable.  However if the data sort of belongs together it is more sensible to keep it together.

Arrays are containers for multiple items of data and you used them in PHP:


This creates an array called george.  It looks the same as a normal variable but you use square brackets at the end.  This identifies which item of data you want to use.  You can think of an array as a box containing other boxes.  An item of data can go in each box:

An array with numeric indexes

Here the array is the red box.  The first "box" inside that contains the number 4.  The two black "boxes" are known as array elements and the 0 and 1 are known as indexes.  Indexes identify the element of the array.

Associative arrays

PHP lets you use words as the index rather than numbers.  This makes it easier for you to remember what is in the array:


Multi-dimensional arrays

Don't worry about how yet (if ever) but you can have multidimensional arrays.  The easiest way to imagine them is that they are arrays inside arrays:

A multidimensional array

This would be useful for the example PHP code as you can now store data for more than one persons:


or more usefully for humans:


By the time you need this you should be ready for it!