Precedence¶
Precedence organizes the way operators are executed, when they are mixed in the same expression.
For example, 1 + 2 * 3 will produce 7, since * has a higher precedence than +.
Every operator has a precedence, and when they have the same precedence, the rightmost one yield to the leftmost one.
Precedence offers some reading surprises to human readers. For example, ! $b instanceof X really applies instanceof first, and && has a higher priority than and, even though they perform the same function.
<?php
var_dump(!$b instanceof \X);
var_dump($a = 1 and 2);
?>
See also Understanding PHP Operators of Logic, or || and && and ! a lot more
Related : Operators