PHP Basic Tutorial
An indexed array is an array where each element is assigned a numeric index. The index starts from 0 by default and increments by 1 for each subsequent element. Indexed arrays are typically used to store a simple list of items such as numbers, strings, or other data types.
Try it yourself
To access an element in an indexed array, you use its index inside square brackets:
Try it yourself
You can change an element’s value by specifying its index:
Try it yourself
You can loop through an indexed array using a foreach
loop:
Try it yourself