PHP Index Array

Techno PHP

PHP index is represented by the number which starts from 0. We can store number, string, an object in the PHP array. All PHP arrays elements are assigned to an index number by default.

PHP index starts from 0. We can store number, string, an object in the PHP array.
All array elements assigned to an index number by default.
Example of index Array .
Example without the key.


Example

<?php
$array = array("Bike ", "Car ", "Bus", "Scooty");
var_dump($array);
?>
Run

Example with key .

Example

<?php
$array = array(
         "car",
         "bike",
    6 => "bus",
         "scooty",
);
var_dump($array);
?>
Run
Index Array is like a linear array that is considered the index numbers values in one row.

Related