PHP coding standards (24)_PHP tutorial

WBOY
Release: 2016-07-13 17:20:27
Original
803 people have browsed it

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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template