Associative Arrays

Arrays are another basic structure in programming languages. Arrays provide means for storing a fixed set (or collection) of the same datatype in a convenient way, making each element of your set indexable by using a unique key.

In the typical "conventional" programming languages, arrays are handled like this:

int my_integer_array[256];          // allocate 256 integers in this array

This C code snippet declares an array called my_integer_array, containing 256 integers. You can address each of these integers by indexing the array with an ordinal value, for this array in a range from 0 to 255. (C starts counting from 0; the given number in the array definition specifies the number of integers you want to have available.) Indexing looks ...

Get Web Application Development with PHP 4.0 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.