Home >Backend Development >PHP Tutorial >PHP coding standards (9)_PHP tutorial
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