How to use for loop concept for php using find array values
for loop is used to initialize the code for how many times it should run.
syntax
for (initialization counter; total counter; increment counter) {
code to be executed;
}
for example
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
<?php
for ($x = 0; $x <= 5; $x++) {
echo "The number is: $x <br>";
}
?>
output
The number is 0 The number is 1 The number is 2 The number is 3 The number is 4 The number is 5
for loop php is used to count and auto increment the array values using loop.
What is Array?
An array is a variable, which can hold more than one value at a time.
php Array basic function defined as
array();
example
< ?php
$design = array('photoshop','flash','dreamviewer','html5');
echo $design[0]; //output is photoshop
echo $design[1]; //output is flash
?>