Chapter 8. Working with Arrays

Arrays are used to store and organize data. PHP includes many functions that enable you to create, modify, and manipulate arrays, which you will use frequently throughout the procedural programming method described in this book.

In this chapter, you learn the basics of working with arrays, including

  • How to create associative and multidimensional arrays

  • How to use the myriad array-related functions built into PHP

What Are Arrays?

You’ve already learned about and used scalar variables in the earlier chapters in this book, and thus you know that these variables are used to store values. But scalar variables can store only one value at a time—the $color variable can hold only a value of red or blue, and so forth, but it cannot ...

Get Sams Teach Yourself PHP, MySQL and Apache All in One, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.