PHP for loop


For loop can be written in three parameters,  first "initial counter", second "condition counter"  third "increment counter"

Syntax : 


for (initial counter; condition counter; increment counter) {
    white for loop actual code here.....
}


Code :

<!DOCTYPE html>
<html>
<body>

<?php  
for ($i = 0; $i <= 10; $i++) {
  echo "Counter : $i <br>";
}
?>
  

</body>
</html>

Output : 

Counter : 1
Counter : 2
Counter : 3
Counter : 4
Counter : 5
Counter : 6
Counter : 7
Counter : 8
Counter : 9
Counter : 10

No comments :