Array is used to store value of same data type in a single variable. In PHP, arrays are ordered map means key-value pair, is used to store value in an array where key can be integer or a string. PHP provides following types of arrays.
Indexed Array | An array with numeric index. |
Associative array | An array with key=value pair. |
Multi-dimensional array | An array with one or more arrays. It is also called Array of Arrays. |
Create an array
PHP provide array() to create array.
Syntax
array_name = array(item1,item2,item3,item4);