Concept

What is the order of precedence and associativity of PHP operators?

ComputerScienceOne / Order of Precedence

"38.2. If, If-Else, If-Else-If Statements Operator(s) Associativity Notes Highest ++ , -- left-to-right increment operators - , ! right-to-left unary negation operator, logical not * , / , % left-to-right + , - left-to-right addition, subtraction < , <= , > , >= left-to-right comparison == , != , === , !== left-to-right equality, inequality && left-to-right logical And || left-to-right logical Or Lowest = , += , -= , *= , /= right-to-left assignment and compound assign- ment operators Table 38.1.: Operator Order of Precedence in PHP. Operators on the same level have equivalent order and are performed in the associative order specified. 6 $r = ($a === $b); //false 7 $r = ($a !== $b); //true The three basic logical operators, not ! , and && , and or || are also supported in PHP. 38.1.1. Order of Precedence At this point it is worth summarizing the order of precedence of all the operators that we’ve seen so far including assignment, arithmetic, comparison, and logical. Since all of these operators could be used in one statement, for example, ($b*$b < 4*$a*$c || $a === 0 || $argc != 4) it is important to understand the order in which each one gets evaluated. Table 38.1 summarizes the order of precedence for the operators seen so far. This is not an exhaustive list of PHP operators."

Related Ideas

What is the order of precedence and associativity of PHP operators? | ComputerScienceOne | Bifalgorithm | Bifalgorithm