Indexed Array
The indexed array is an array with values only. The values are accessed through a numeric index. An index starts from zero. Programmers coming from other programming languages are familiar with indexed arrays.
xxxxxxxxxx
19
<?php
//An example of indexed array
$indexed_array = [1,2,3,4,5,6,7,8,9,10];
//Output : 1
echo $indexed_array[0];
//Output : 2
echo $indexed_array[1];
//Output : 3
echo $indexed_array[2];
//Output : 10
echo $indexed_array[-1];
?>
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment