Chapter 2. Arrays

The focus of this chapter is one of the most powerful data structures available to PHP developers today—the array. Despite its relative ease of use, an array is considered one of the two complex data types available in PHP (the second is objects discussed in Chapter 13, "Object-Oriented Programming in PHP").

Basic Arrays

In PHP (and unlike most other programming languages that implement them) arrays are a means of grouping any number of different variables, regardless of type, into a single variable. Technically, arrays actually represent an ordered map that maps key values to pieces of variable data (see Figure 2.1). The contents of a value pointed to by a key ...

Get PHP 5 Unleashed 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.