PHP Coding Specification (_php) tutorial

Source: Internet
Author: User
9.1 Constants

The numeric constants that are used as counter values in the For loop, except for -1,0 and 1, should not be written directly to the code.

9.2 Assigning values to variables

Avoid assigning the same value to multiple variables in a single statement. It's hard to read. For example:
$fooBar. Fchar = $barFoo. Lchar = C; Error

Do not use assignment operators in places that are easily confused with equality-relational operators. For example:
if ($c + + = $d + +) {//Error
...
}

should be written
if (($c + + = $d + +)! = 0) {
...
}

Do not use the inline (embedded) assignment operator to try to improve the efficiency of the runtime, which is the work of the compiler. For example:
$d = ($a = $b + $c) + $r; Error

should be written
$a = $b + $c;
$d = $a + $r;


http://www.bkjia.com/PHPjc/532581.html www.bkjia.com true http://www.bkjia.com/PHPjc/532581.html techarticle 9.1 Constants are numeric constants that are used as counter values in a for loop and should not be written directly to the code except for -1,0 and 1. 9.2 variable assignment avoid assigning the same to multiple variables in one statement ...

  • 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.