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

PHP coding standards (9)_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:20:16763browse

5.1 Number of variables declared per line

It is recommended to declare one statement per line because it makes it easier to write comments. That is,


int $level; // The degree of indentation
int $size; // Determined by tab characters

Be better than,

int $level, $size;

Do not place declarations of different types of variables on the same line, for example:


int $foo, $fooarray[]; //Error

Note: In the above example, a space is placed between the type and identifier. Another allowed alternative is to use the tab character:


int $level; // The degree of indentation
int $size; // Determined by the tab character
$currentEntry; // The tab character is usually selected as the indentation standard


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532595.htmlTechArticle5.1 The number of variables declared per line is recommended to be declared one line at a time, because this makes it easier to write comments. That is, int $level; // The degree of indentation int $size; // determined by tabs is better than i...
Statement:
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