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

PHP coding standards (11)_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-13 17:20:20
Original
726 people have browsed it

5.4 Class declaration

When writing classes, the following formatting rules should be followed:

- There should be no space between the left bracket "(" before the method name and its parameter list
- The left brace "{" is at the end of the declaration statement
- The right brace "}" starts on a new line , aligned with the corresponding declaration statement, unless it is an empty statement, "}" should follow "{"

class Sample extends Object {
 int $ivar1;
 int $ivar2;

function Sample(int $i, int $j) {
ivar$1 = $i;
ivar$2 = $j;
}

function emptyMethod() {}

 ...
}

- Methods are separated by blank lines


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532593.htmlTechArticle5.4 Class declaration When writing a class, the following formatting rules should be followed: - Before the method name and its parameter list There should be no spaces between left brackets "(" - left curly brackets "{" are placed on the same line as the declaration statement...
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template