PHP coding specification (20)

Source: Internet
Author: User

8.1 namespace

The prefix of a unique namespace is always all lowercase ASCII letters and a top-level domain name, usually com, edu, gov, mil, net, org, or the English dual-character code specified by the ISO 1981 standard in 3166. The subsequent sections of the namespace vary according to the naming rules of different organizations. Such naming conventions may consist of specific directory names to differentiate departments, projects, machines, or login names ), it can also be categorized by function module.


8.2.1 class attribute naming

The attribute name should be prefixed with the character 'M.
The prefix 'M' follows the same class naming rule.
'M' always acts as a modifier at the beginning of the name, just like a reference starting with 'R.
Reason
Prefix m prevents any conflicts between class attributes and method names. Your method name and attribute name are often very similar, especially for accessing elements.
For example
Class NameOneTwo
{
Int $ mVarAbc;
Int $ mErrorNumber;
String $ mrName;
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.