Breaking

LightBlog

Saturday 4 July 2015

For loop in php


For loop for loop is used to initialize, testing and increment/decrement into single line .this is fast and simple loop.
Syntax .for (variable initialize; testing; increment /decrement)

                                                    

   
Program     

<?php
for($b=1; $b<10; $b++)                                           //in this we simple increment the value
echo "<br>".$b;
?>


<?php
echo "<h3>this is the for loop example";
for($a=10;$a>1;$a--)                                                //this is used to subtract the one value in the current value
echo "<br>".$a;
?>
        
                         

Video tutorial 


                                          
             
Adbox