PHP coding specification (19)

Source: Internet
Author: User
7.2 use spaces in the following cases:-a keyword followed by parentheses should be separated by spaces, for example: while (true ){...} note: spaces should not be placed between the method name and the left parenthesis. This will help distinguish between keywords and method calls. -The blank space should be placed behind the comma in the parameter list-all binary SyntaxHighlighter. all (); 7.2 spaces

Spaces should be used in the following cases:
-A keyword followed by parentheses should be separated by spaces, for example:
While (true ){
...
}

Note: spaces should not be placed between the method name and the left parenthesis. This will help distinguish between keywords and method calls.
-The blank space should be placed behind the comma in the parameter list
-All binary operators except "." should be separated by spaces from the operands. There is no space between the unary operator and the operand, for example, minus sign ("-"), auto-increment ("++"), and auto-subtraction ("--"). For example:
$ A + = $ c + $ d;
$ A = ($ a + $ B)/($ c * $ d );

While ($ d ++ = $ s ++ ){
$ N ++;
}
PrintSize ("size is" + $ foo + "");

-The expressions in the for statement should be separated by spaces, for example:
For (expr1; expr2; expr3)

-A space should be followed after forced transformation, for example:
MyMethod (byte) $ aNum, (int) $ x );
MyMethod (int) ($ cp + 5), (int) ($ I + 3) + 1 );


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.