An indexed array stores each array element with a numeric index. The following examples shows two ways of creating an indexed array, the easiest way is:
An indexed array stores each array element with a numeric index. The following examples shows two ways of creating an indexed array, the easiest way is:
<?php
$array = array('Apple', 'Mango', 'Banana', 'Apricot', 'Blackberry');
?>
Note: In an indexed array, the indexes are automatically assigned and start with 0
<?php
$array[0] = 'Apple';
$array[1] = 'Mango';
$array[2] = 'Banana';
$array[3] = 'Apricot';
$array[4] = 'Blackberry';
?>