1for (initialization; condition; increment){
2 code to be executed;
3}
4//Example
5<?php
6 $a = 0;
7 $b = 0;
8 for( $i = 0; $i<5; $i++ )
9 {
10 $a += 10;
11 $b += 5;
12 }
13echo ("At the end of the loop a = $a and b = $b" );
14?>
15//.......................................//
16 do {
17 code to be executed;
18}
19while (condition);
20//Example
21<?php
22 $i = 0;
23 $num = 0;
24
25 do {
26 $i++;
27 }
28
29 while( $i < 10 );
30 echo ("Loop stopped at i = $i" );
31?>