So far we've looked at the basic variables types such as strings and integers, as well as a variety of functions you can use to manipulate these data types. Beyond the basic data types are arrays and objects, which take a little bit more work in order for you to take advantage of them properly. More importantly, arrays take a solid understanding of functions before you try to use them, which is why they are separated here! As mentioned, objects are covered exclusively in their own chapter - this chapter is dedicated to the topic of arrays.
In order to model our surroundings in a programming environment accurately, it is important to recognise that some types of data naturally group together - colours, for example, naturally clump together into one group. Rather than having hundreds of separate variables - one for each colour - the reality is that it makes more sense to have one variable that holds a list, or array of colours.
Topics covered in this chapter are:
Multidimensional arrays (arrays of arrays)
If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!
Next chapter: First steps >>
Previous chapter: Next chapter
Home: Table of Contents
Copyright ©2015 Paul Hudson. Follow me: @twostraws.