Home >Backend Development >PHP Tutorial >PHP coding standards (20)_PHP tutorial
8.1 Namespace
The prefix of a unique namespace is always all lowercase ASCII letters and is a top-level domain name, usually com, edu, gov, mil, net, org, or the English double that identifies the country as specified by the 1981 ISO 3166 standard. Character code. The subsequent parts of the namespace vary according to the internal naming conventions of different institutions. Such naming conventions may use the composition of specific directory names to distinguish departments, projects, machines, or login names, or they may be classified by functional modules.
8.2.1 Naming of class attributes
Attribute names should be prefixed with the character 'm'.
The prefix ‘m’ follows the consistent rules for class naming.
‘m’ always modifies the beginning of a name, just like ‘r’ represents a reference.
Reason
The prefix m prevents any conflicts between class attribute and method names. Your method names and property names will often be very similar, especially when accessing elements.
For example
class NameOneTwo
{
int $mVarAbc;
int $mErrorNumber;
String $mrName;
}