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

PHP coding standards (6)_PHP tutorial

WBOY
Release: 2016-07-13 17:20:30
Original
837 people have browsed it

4.2 Single-line comments

Short comments can appear on one line and have the same indentation level as the following code. If a comment cannot be written in one line, use a block comment. Single-line comments should be preceded by a blank line. Here is an example of a single line comment in code:


if (condition) {

 /* Conditions for the following code to run */
 ...
}
4.3 End comments

Very short comments can be on the same line as the code they describe, but there should be enough white space to separate the code and comments. If multiple short comments appear in a large block of code, they should have the same indentation.

The following is an example of a trailing comment in code:


if ($a == 2) {
return TRUE; /* Explanation of a single condition*/
} else {
return isPrime($a); /* The rest Conditions*/
}


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532598.htmlTechArticle4.2 Single-line comments Short comments can be displayed in one line and have the same indentation level as the following code. If a comment cannot be written in one line, use a block comment. Single line note...
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