Advertisement
Google Ad Slot: content-top
PHP Indexed Arrays
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.
Access Indexed Arrays
To access an element in an indexed array, you use its index inside square brackets:
Change Value
You can change an element’s value by specifying its index:
Loop Through an Indexed Array
You can loop through an indexed array using a foreach loop: