PHP Arrays

PHP array is a series of elements of the similar type placed in contiguous memory locations that can be accessed individually by adding an index to a unique identifier. An array is made up of a key and a value pair, and the key points to the value.

There are three types of arrays: Indexed array ,Associative array and Multidimensional array.

Indexed Array in PHP

In an indexed array, the keys on index are numeric and starts with 0.

Associative Array in PHP

in associative array, the keys are not necessarily numeric, they are similar to Index arrays in functionality but they are different in terms of their indexing. In associative array indexing is string based.

Multidimensional Array in PHP

Multidimensional arrays can be described as “arrays of arrays”.Multidimensional arrays are not limited to two indices . They can contain as many indices as needed. The amount of memory needed for an array rapidly increases for each dimension.