PHP array
new thing is the associative array in this indexing is done with some strings like in our example home is name of array and indexing is name of owner and that value refer location of home.
Program :
<html>
<head>
<title>PHP Array</title>
</head>
<body>
<?php
$no[1]=10;
$no[2]=20;
$no[3]=45;
echo "Number array is : $no[1] $no[2] $no[3]";
//Associative array
$home["prashant"]="sangamner";
$home["Bharat"]="Dhandharphal";
$home["Vishal"]="Zole";
echo "<br> Home of Prashant is ".$home["prashant"]."<br>Home of Vishal is ".$home["Vishal"]."<br>Home of Bharat is ".$home["Bharat"];
?>
</body>
</html>
OUTPUT :
Program :
<html>
<head>
<title>PHP Array</title>
</head>
<body>
<?php
$no[1]=10;
$no[2]=20;
$no[3]=45;
echo "Number array is : $no[1] $no[2] $no[3]";
//Associative array
$home["prashant"]="sangamner";
$home["Bharat"]="Dhandharphal";
$home["Vishal"]="Zole";
echo "<br> Home of Prashant is ".$home["prashant"]."<br>Home of Vishal is ".$home["Vishal"]."<br>Home of Bharat is ".$home["Bharat"];
?>
</body>
</html>
OUTPUT :
0 comments:
Post a Comment