Operator precedence

Table of operator precedence
Operator Description
postfix: (), [], . change operators’ precedence with parentheses
takes element from array or string
gets property of class
prefix: !, - not, unary minus
*, /, % multiplication
division
modulus
+,- adds two numbers or element to array or concatenates two strings
arithmetic minus
==, !=, >, <, >=, <= comparison operators, return 1 if true, 0 if false
&& logic “and”
|| logic “or”
is, !is checks whether left operand is of right operand’s type
checks if left operand is not right operand’s type
if(..) .. else .. ternary operator
= assigns right operand to the left operand. the only one with right to left associativity

Main | Writings | Drawings

꧁༻ ༺꧂