php
For loop php
<?php
for ($i = 0; $i <= 3; $i++) {
echo "Loop counter is : " . $i;
}
?>
Output
Loop counter is : 0
Loop counter is : 1
Loop counter is : 2
Loop counter is : 3
Loop counter is : 1
Loop counter is : 2
Loop counter is : 3
Code snippet shows basis for loop used in PHP. We have declared a variable $i and looping 4 times.
Was this helpful?
Similar Posts