PHP Tutorials - Herong's Tutorial Examples
Dr. Herong Yang, Version 3.00

Arrays - Ordered Maps

This chapter provides tutorial examples and notes about arrays. Topics include creating arrays with the array constructor, using integer keys or string keys in arrays, accessing values through keys, array related built-in functions.

What Is an Array?

Creating Arrays - Examples

Array Related Built-in Functions

Conclusion:

  • An array can be created with the array constructor, array().
  • A pair of key and value can be specified as key=>value as an argument in the constructor.
  • A value stored in an array can be accessed as $array_variable["key"].
  • An array can be used as a stack through array_push() and array_pop() functions.
  • "foreach () {}" statement can be used to loop through all values in an array.

Dr. Herong Yang, updated in 2009
Arrays - Ordered Maps