Arrays in php

Array in php is used to store similar set of data. Array is used to store one or more elements in a single variable name.

Each element in the array can be easily accessed through its index.

Types of Array
Normally there are three types of array used in the php.
1) Numeric Array.
2)Associative Array.
3)Multidimensional Array.

Numeric Array
Any element in numeric array is stored with a numeric ID key.


$names_people = array("Adeel","Haris","Omer");

You can also assign the ID key yourself!

$names_people[0] = "Adeel";
$names_people[1] = "Haris";
$names_people[2] = "Omer";

Now you can get the values of array element like this, for example you want to the value of second element because