PHP coding specifications (3)

Source: Internet
Author: User

3.2 import statements

The import statement should be in the header of the file and describe the role of the file when introducing the statement. For example:

// Database operations
Require ("db. php ");
Declaration of the 3.3 Class

Annotation of Class 1 Documents (/**...... */) The information to be included in the comment. For more information, see "document comment"
Class 2 Declaration
Annotations for the three types of implementations (/*...... */) If necessary, the comment should contain any information about the entire class, which is not suitable for commenting on the class document.
Class 4 (static) variables are first the public variables of the class, followed by the protection variables, then the variable at the package level (no access modifier, access modifier), and finally the private variables.
5. The instance variables are at the public level first, followed by the protection level, followed by the package level (no access modifier), and finally the private level.
6 Constructor
7. These methods should be grouped by functions, rather than scope or access permissions. For example, a private class method can be placed between two public instance methods. The purpose is to make it easier to read and understand the code.


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.