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

PHP coding standards (12)_PHP tutorial

WBOY
Release: 2016-07-13 17:20:22
Original
891 people have browsed it

6.1 Simple Statements

Each line contains at most one statement, for example:


$argv++; // Correct
$argc--; // Correct
$argv++; $argc--; // Correct

6.2 Compound Statement

A compound statement is a sequence of statements enclosed in braces, in the form of "{ statement }". For example, the following paragraphs.

- The enclosed statement should be indented one level compared to the compound statement
- The left brace "{" should be located at the end of the line that starts the compound statement; the closing brace "}" should start on a new line and be indented Align with the first line of a compound statement.
- Braces can be used for all statements, including single statements, as long as they are part of a control structure such as if-else or for. This makes it easy to add statements without worrying about introducing bugs by forgetting to add parentheses.



www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532592.htmlTechArticle6.1 Simple statements contain at most one statement per line, for example: $argv++; // Correct $argc-- ; // Correct $argv++; $argc--; // Incorrect 6.2 Compound Statements Compound statements are contained in large...
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