How to print array values in php using find i value – Indexed array

0

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

Cinema Latest news - Cinema News | Tamil News | Tamil Cinema | Daily Cinema | Tamil Cinema Trailer | Tamil Cinema Teasers | Tamil Cinema reviews | Tamil Cinema News | Tamil Cinema Reviews | Tamil Movie Reviews | Kollywood News - provided Latest cinema news, Tamil cinema updates, cinema exclusive news, video, audio, photos, movies, teasers, trailers, entertainment and other Tamil cinema news 24/7 updates

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

?>

For more Explanation click here

Share.

About Author

I'm Rajasekar - Web developer, Freelancer, Blogger and Owner of DeveloperDesks. From India lives in Bahrain. I love to do coding, Creating websites and trying different with code and designs. You Can Hire Me