Chapter 5. ARRAYS

Topics in This Chapter

  • Single-Dimensional Arrays

  • Indexing Arrays

  • Initializing Arrays

  • Multidimensional Arrays

  • Casting Arrays

  • Referencing Arrays Inside Strings

Arrays collect values into lists. You refer to an element in an array using an index, which is often an integer but can also be a string. And the value of the element can be text, a number, or even another array. When you build arrays of arrays, you get multidimensional arrays. Arrays are used extensively by PHP's built-in functions, and coding would be nearly impossible without them. There are many functions designed simply for manipulating arrays. They are discussed in detail in Chapter 9.

Get Core PHP Programming: Using PHP to Build Dynamic Web Sites 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.