Simple Arrays
Indexed Arrays<?php
$cars = array("Volvo", "AUDI", "TATA");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";?>
Associative Arrays<?php
$cars = array("Volvo", "AUDI", "TATA");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";?>
<?php$cars = array("Volvo", "AUDI", "TATA");
$arrlength = count($cars);
for($x = 0; $x < $arrlength; $x++)
{
echo $cars[$x];
echo "<br>";
}?>
<?php
$age = array("Roop"=>"45", "Krish"=>"49", "Dino"=>"23");
echo "RAM is " . $age['RAM'] . " years old.";?>
<?php$age = array("Roop"=>"45", "Krish"=>"49", "Dino"=>"23");
foreach($age as $x => $x_value)
{
echo "Key=" . $x . ", Value=" . $x_value;
echo "<br>";
}?>