How to print array values indexing in php using Indexed array
Indexed array is array with a numeric index. Index will Start with ‘0’ and it can be assigned automatically
example
< ?php $design = array(‘photoshop’,’flash’,’dreamviewer’,’html5′); echo $design[0]; //output is photoshop echo $design[1]; //output is flash ?>
If you know the total number of array values means you can do like this,
For unknown and unlimited array values are present then go to Forloop
Example
< ?php
$var1 = array('one','122','122','122','dfd','dfgdf','dfgdfg','dfgdfg','dfgdfgf','dfgdfg','dfgdfgdf','gfdgdfg','dfgdfgdf','fdg','dfgdf','last');
$total = count($var1); // Use Count(); functions
for($i=0; $i< $total; $i++)
{
echo "$var1[$i]
";
}
?>
To know the array total values use count(); Functions
2. Count();
This Function is used to fin the count of array key in the array.
3. Associative array()
Associative array is array that use named keys that you assign to them.
example
<?php
$var2 = array('raj'='123','sekar'=>'213','developer'=>'545','desks'=>'345');
echo $var2['raj']; // output is 123
echo $var2['sekar']; // output is 213
echo $var2['developer']; // output is 545
echo $var2['desks']; // output is 345
?>


