How to use for loop in php

PHP
We will show the simple example of for loop. For loop is based on 3 parameters .
First is to initialize the value or we can say starting point .
Second parameter is for condition.
Third is for incrementing the value of variable.
For loop is very easy but very logical in php it is needed every where but if you know its use then you can play with for loop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>FOR LOOP Examples in PHP</title>
</head>
<body>
<?php
//Lets take one simple example of array to print values with the for loop
$array = array('A','B','C','D');

//It will show the total vales of array as 4
$counter = count($array);
//Now we will print the data with the for loop
//$p<$counter means it will work till the $p is less that $counter and $p will add 1 every time when the loop moves
for($p=0;$p<$counter;$p++)
{
//It will show that array whose index is 0 and its value is A
echo'$Array['.$p.']=='.$array[$p];
echo '<br>';
}

//Lets take one more example to print values from 1 to 100 by for loop

for($m=1;$m<=100;$m++)
{
//This will print 1 to 100 with one line space
echo $m;
echo '<br>';
}
?>
</body>
</html>
-->