...
Class names should be CamelCased. Only a single class should appear in a file. Class file names should correlate to the class name, be lowercase, and use underscores to separate words. Class constructors should be named using the __construct() magic method.
Warning |
---|
|
Code Block |
---|
language | php |
---|
title | my_class.php |
---|
linenumbers | true |
---|
| <?php
// Class name starts with a lower case letter
class myClass {
// Constructor should be named __construct()
public function myClass() {
}
}
?> |
|
Tip |
---|
|
Code Block |
---|
language | php |
---|
title | my_class.php |
---|
linenumbers | true |
---|
| <?php
class MyClass {
public function __construct() {
}
}
?> |
|
Methods
Method names should begin with a lowercase letter and be camelCased. Type hinting should be used whenever possible, but must conform to PHP 5.1 syntax (i.e. only objects and arrays may be defined using type hints).
...
Tip |
---|
|
Code Block |
---|
| /**
* This is a doc DocBlockblock comment
*/
function foo() {
} |
|
...