Home > PHP > PHP Array

PHP Array

ARRAY – An array stores multiple values in one single variable…

In PHP there are three kinds of ARRAY’s.They are,

1.Numeric Array (A numeric array stores each array element with a numeric index.)

2.Associative Array (An associative array, each ID key is associated with a value.)

3.Multidimensional Array (In a multidimensional array, each element in the main array can also be an array.

and each element in the sub-array can be an array, and so on.)

1.Numeric Array :

Two Methods.They are,


2.$fruits[0]=”apple” ;

$fruits[1]=”orange” ;





echo $fruits[0].” and “.$fruits[1].” are very tasty ”


2.Assosiative Array :

Two Methods.They are,







echo ” vijayan is “.$ages[‘vijayan’].” years old “;


3.Multidimensional Array :

$family=array( “Parents”=>array(“a”,”b”) , “Brothers”=>array(“c”,”d”) , “Sisters”=>(“e”,”f”,”g”));

Example :


echo $family[‘parents’][1];


  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: