Home >Backend Development >PHP Tutorial >PHP coding standards (24)_PHP tutorial

PHP coding standards (24)_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 17:20:27868browse

9.3.1 Parentheses

In general, it is a good idea to use parentheses in expressions that contain multiple operators to avoid operator precedence issues. Even though operator precedence may be clear to you, it may not be so to others. You cannot assume that other programmers know operator precedence as well as you do.
if ($a == $b && $c == $d) // Wrong
if (($a == $b) && ($c == $d)) // Correct


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532580.htmlTechArticle9.3.1 Parentheses Generally speaking, use parentheses in expressions containing multiple operators to avoid Operator precedence issue is a good approach. Even though the operator precedence may be different for you...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn