PHP code specification analysis. I. writing Rule 1-indent. Use Tab (Tab key) indentation. the unit of indentation is 4 spaces. The length of a single line is controlled within 80 characters. if it is too long to start another line, it is in a reasonable position.
I. writing rules
1-> indent. Use tabs ( Key) indent. the unit of indentation is 4 spaces. The length of a single line is controlled within 80 characters. if it is too long to start another line, it is disconnected at a reasonable position and indented by 8 characters to distinguish normal indentation.
2-> braces {}. Place braces in the same column (lower) of the keywords. You can use either of the following methods.
3-> Keywords, parentheses, functions, and operators. Parentheses and keywords are separated by a space. parentheses and functions must be pasted together to distinguish between keywords and functions. There must be a space between the operator and the variables or expressions on both sides (except for the character link operator.
($boo == ){
4-> when the code segment is large, the upper and lower lines should be added with blank lines. Only one blank line is used between the two code blocks, and multiple lines are prohibited.
5-> try not to use parentheses in the return statement. For example, return 1.
II. naming rules
1-> class name. The first character is capitalized, that is, the big camper name method. Such as Sample and BigClassObject.
2-> class property name. 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. The 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, mValue or mLongString.
3-> method name. The big hump method is adopted. Prefix Is best a verb, such as: Is, Get, Set, to describe the function of this method. For example, the parameter name in the GetNum, IsValue... method adopts the small camper name method.
4-> Variable/function naming. All letters are in lower case and the underscore _ is used as the boundary of each word. For example, $ msg_error and $ che_pwd. That is, the underline naming method.
5-> constant/global constant naming. All letters are in uppercase and the underscore _ is used as the word boundary.
For example: $ define ('default _ NUM_AVE ', 90 );
6-> Global variable: add the prefix "g", static variable: add the prefix "s", and reference variable: add the prefix "r ".
Indent 1-indent. Use Tab (Tab key) indentation. the unit of indentation is 4 spaces. The length of a single line is controlled within 80 characters. if the length is too long to start another line, it is in a reasonable position...