Arrays
An array is data structure that can store multiple homogenous values in a single variable. Each value is associated with a key that is used to identify it and return it.
Numeric Array
These are arrays that use numbers as their index. The index begins at zero by default.
They are two ways to create numeric arrays:
- This way automatically assigns the index:
$dairy = array(“yoghurt”, “ice cream”, “cheese cake”);
- This way assigns the index manually:
$dairy[0] = “yoghurt”
$dairy[1] = “ice cream”
$dairy[2] = “cheese cake”