Home of web learners


array is used to store many variable data into only one variable

As you want to work with some data like 50 people monthly income,so what you going to do?

Assigning 50 variable and then store there,but if you can do it with very easy way,so here is array

You don't need to assign multiple variable,just use one variable for all data

Lets look an example:

$color = array("green", 6, "blue");
echo $color[0]."<br/>";
echo $color[1];




so here we see that we can create 3 data into only one variable

To create array we use array function and inside this we assign data

For working we can use just the index of the variable as order

In array indexing start from 0,so for showing first variable we use it like with index,here $color[0]

There are mainly two array type in php,this type called indexed array


About webn3rd