In the process of software development, you sometimes need to use multiple forms of for statements flexibly. Other forms of for statements are listed in the example code!
// The first change extracts the first part of the for Loop syntax
<? Php
$ I = 1;
For (; $ I <2; $ I ++) {// The first semicolon cannot be omitted.
Echo "This is the first output". $ I! </Br> ";
}
?>
// For the second change, extract the first part of the for Loop syntax, and put the increment of the third part into the for loop body.
<? Php
$ I = 1;
For (; $ I <2;) {// The first semicolon cannot be omitted
Echo "This is the first output". $ I! </Br> ";
$ I ++;
}
?>
// In the third change, all for loop syntax is omitted.
<? Php
$ I = 1;
For (;) {// The first semicolon cannot be omitted
If ($ I> 1)
Break;
Echo "This is the first output". $ I! </Br> ";
$ I ++;
}
?>
All programs have been tuned in Apache 2.2 + PHP5.2.6!
If the program is poor, it will be changed, and the general principles will be reached. It seems that there is also such a philosophy in the program!
From the column in chuoyue05