In many cases, an expression may contain different type of operators, such as the one shown here.
PHP
$a * $b + 2 > 21  !($c == $b / 2) && $c > 13
In such cases, arithmetic operations are performed first, comparison operations are performed next, and logical operations are performed at the end, as shown in the following table
Higher Precedence Lower Precedence 
Arithmetic Operators 



Comparison Operators 


Logical Operators 





Java, C++, C#
a * b + 2 > 21  !(c == b / 2) && c > 13
In such cases, arithmetic operations are performed first, comparison operations are performed next, and logical operations are performed at the end, as shown in the following table
Higher Precedence Lower Precedence 
Arithmetic Operators 



Comparison Operators 


Logical Operators 





Visual Basic
a * b + 2 > 21 Or Not(c = b / 2) And c > 13
In such cases, arithmetic operations are performed first, comparison operations are performed next, and logical operations are performed at the end, as shown in the following table
Higher Precedence Lower Precedence 
Arithmetic Operators 
^ 




Comparison Operators 


Logical Operators 





Python
a * b + 2 > 21 or not(c == b / 2) And c > 13
In such cases, arithmetic operations are performed first, comparison operations are performed next, and logical operations are performed at the end, as shown in the following table
Higher Precedence Lower Precedence 
Arithmetic Operators 
** 




Comparison and Membership Operators 


Logical Operators 


and 

or 