$var = array("value","value","value" );
In the upper php code array name is start from $ sign and variable name “$variable_name” . Then value is array() function . Array ( ) is built in function in php and you have no need to create this function .
Just call the array ( ) function and write array values in the braces . For example array (“value1″,”value2″,”value3” ) . These values are numerically indexed . Indexed means value1-index number is 0 , value2 -index number is 1 , as so on .
It means if you call index number 0 , that means you call value1 .
<html> <head> </head> <body> <?php $fruits = array("banana","apple","pineapple"); echo "Fruit name is ".$fruits; ?> </body> </html>
Copy this code in any php editor like notepad++ or simple notepad. Save it as index.php . When you run this code ,result is
Fruit name is apple
In this php code $fruits is array name .Which can hold multiple values and indexed it . And fruits banana, apple and pineapple are values of array . When you call $fruits , it means you call second value of array. When you change $fruits , then result is “Fruit name is pineapple” .
An array can hold same type of values .