May 2003
Intermediate to advanced
592 pages
14h 28m
English
The final variable type I’ll introduce in this book is the array. Unlike strings and numbers (which are scalar variables, meaning they are single-valued), an array can hold multiple, separate pieces of information. An array is therefore like a list of values, each value being a string or a number or even another array.
Arrays are structured as a series of key-value pairs. For each item in the list, there is a key (or index) associated with it. The resulting structure is not unlike a spreadsheet or database table (Table 2.2).
| Array Example 1: $artists | |
|---|---|
| KEY | VALUE |
| 0 | Low |
| 1 | Aimee Mann |
| 2 | Ani DiFranco |
| 3 | Spiritualized |
| 4 | Air |
PHP supports two kinds of arrays: indexed, which use numbers as the ...
Read now
Unlock full access