PHP Arrays
PHP Code Examples
PHP arrays are remarkably general-purpose data structure. They are essentially hash tables, like %hashes in perl, or maps in Java or C++, but with a number of additional features. PHP arrays are array-like when the keys are contiguous integers. Keys may be strings or integers, and values may be of any type, including other arrays, which allows the programmer to build complex structures. PHP arrays also retain keys in the order in which they are first inserted, allowing arrays to function as lists also.

Here's a hash-like array: Array ( [snake] => oil [tv] => wasteland [titanic] => sank )

Here's an array-like array: Array ( [0] => oil [1] => wasteland [2] => sank )

Array-like arrays can be created with a list syntax: Array ( [0] => oil [1] => wasteland [2] => sank )

Use [] to subscript.
Array ( [0] => 5 [1] => 10 [2] => 34 [3] => 11 [4] => 2 )
Array ( [0] => 5 [1] => Mike [2] => 34 [3] => 11 [4] => 2 [5] => 3.3 [zippy] => ... [33] => Tuesday [10] => 22 )

Default subscript is 1 + max existing numberic subscript, or zero.
Array ( [5] => 3 [6] => 19 [7] => 87 [8] => 1 [9] => 77 )
Array ( [0] => 3 [1] => 11 [20] => snakes [21] => horses [22] => antelope [10] => 4.4 [23] => Smile )