Sunday, January 1, 2012

Array Demo in PHP

Example



<body bgcolor="#CCCCFF">
<font size="+4" ><center>ARRAY DEMO</font></marquee></center><br><br>
</head>
<body>
<?php


$test=array(501=>"ITIM",502=>"UNIX",503=>"AWT",504=>"JAVA",505=>"PHP",506=>"PRACTICAL");
echo "<h4>"."1.NUMBER OF ITEMS STORED IN ARAAY ARE::".count($test)."(using count())"."<br><br>";
echo "2.SCROLLING THE ITEMS:"."<br><br>";
echo "Current::".current($test)."<br>";
echo "Next::".next($test)."<br>";
echo "Prev::".prev($test)."<br>";
echo "Last::".end($test)."<br><br>";
echo "3.STORED ITEM IN ARRAY ARE AS FOLLOWS(using foreach loop)"."<br><br>";
foreach($test as $a)
{
echo $a;
echo "<br>";
}
echo "<br><br>";
/*do
{
echo current($test);
echo "<br>"
}while($a=next($test))*/


echo "4. ARRAY INSPECTION (ISARRAY)::".is_array($test)."<br>";




?>
</body>

No comments:

Post a Comment