Home > Backend Development > PHP Tutorial > PHP coding standards (15)_PHP tutorial

PHP coding standards (15)_PHP tutorial

WBOY
Release: 2016-07-13 17:20:28
Original
756 people have browsed it

6.5 for statement

A for statement should have the following format:


for (initialization; condition; update) {
 statements;
}

An empty for statement (all work is done in initialization, conditional judgment, update clause) should have the following format:


for (initialization; condition; update);

When using commas in the initialization or update clause of a for statement, avoid the increased complexity caused by using more than three variables. If necessary, you can use separate statements before the for loop (for the initialization clause) or at the end of the for loop (for the update clause).

6.6 while statement

A while statement should have the following format
while (condition) {
 statements;
}

An empty while statement should have the following format:
while (condition) ;
6.7 do...while statement

A do-while statement should have the following format:

do {
 statements;
} while (condition);


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532589.htmlTechArticle6.5 for statement A for statement should have the following format: for (initialization; condition; update) { statements; } a Empty for statement (all work is initialization, conditional judgment, more...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template