| P | A | Operator | Operation |
| 19 | N | new | Create new object |
| 18 | R | [ | Array subscript |
| 17 | R | ! | Logical NOT |
| R | ~ | Bitwise NOT The bitwise negation operator changes 1s to 0s and 0s to 1s in the binary representations of the operands. | |
| R | ++ | Increment | |
| R | -- | Decrement | |
| R | (int) (double) (string) (array) (object) | Cast | |
| R | @ | Inhibit errors | |
| 16 | L | * | Multiplication |
| L | / | Division | |
| L | % | Modulus | |
| 15 | L | + | Addition |
| L | - | Subtraction | |
| L | . | String concatenation | |
| 14 | L | << | Bitwise shift left Shifts the bits in the binary representation of the lefthand operand left by the number of places given in the righthand operand. |
| L | >> | Bitwise shift right Shifts the bits in the binary representation of the lefthand operand right by the number of places given in the righthand operand. | |
| 13 | N | <,<= | Less than, less than or equal to |
| N | >,>= | Greater than, greater than or equal to | |
| 12 | N | == | Value equality If both operands are equal, this operator returns true; otherwise, it returns false. |
| N | !=,<> | Inequality If both operands are not equal, this operator returns true; otherwise, it returns false. | |
| N | === | Type and value equality If both operands are equal and are of the same type, this operator returns true; otherwise, it returns false. | |
| N | !== | Type and value inequality If both operands are not equal, or they are not of the same type, this operator returns true; otherwise, it returns false. | |
| 11 | L | & | Bitwise AND Compares each corresponding bit in the binary representations of the operands. If both bits are 1, the corresponding bit in the result is 1; otherwise, the corresponding bit is 0. |
| 10 | L | ^ | Bitwise XOR Compares each corresponding bit in the binary representations of the operands. If either of the bits in the pair, but not both, is 1, the corresponding bit in the result is 1; otherwise, the corresponding bit is 0. |
| 9 | L | | | Bitwise OR Compares each corresponding bit in the binary representations of the operands. If both bits are 0, the corresponding bit in the result is 0; otherwise, the corresponding bit is 1. |
| 8 | L | && | Logical AND Evaluates to true if and only if both operands are true; otherwise, it is false. |
| 7 | L | || | Logical OR Evaluates to true if either operand is true; otherwise, it is false. |
| 6 | L | ?: | Conditional operator PHP's only ternary (three-operand) operator and is therefore sometimes just called the ternary operator. It evaluates the expression before the ?. If the expression is true, the operator returns the value of the expression between the ? and the :; otherwise, the operator returns the value of the expression after the : $reply = ( $in == 'yes' ) ? 'Great' : 'Too bad' ;This is functionally equivalent to:
if ( $in == 'yes' ) {
$reply = 'Great' ;
} else {
$reply = 'Too bad' ;
}
|
| 5 | L | = | Assignment |
| L | +=, -=, *=, /=, .=, %=, &=, |=, ^=, ~=, <<=, >>= | Assignment with operation
$x += $y ; $j .= $kare the same as: $x = $x + $y ; $j = $j . $k ; | |
| 4 | L | and | Logical AND Evaluates to true if and only if both operands are true; otherwise, it is false. The and operator differs from the && operator only in precedence. |
| 3 | L | xor | Logical XOR Evaluates to true if either operand but not both, is true; otherwise, it is false. |
| 2 | L | or | Logical OR Evaluates to true if either operand is true; otherwise, it is false. The or operator differs from the || operator only in precedence. |
| 1 | L | , | List seperator |