Operators in PHP
Advertisements
Operators in PHP
Operators is a symbol which is used to perform operations on operands. Here you can see very simple example of operator
Example
$num=4+5;
In the above example, + is the binary + operator, 4 and 5 are operands and $num is variable.
PHP divides the operators in the following groups:
- Arithmetic Operators
- Comparison Operators
- Bitwise Operators
- Logical Operators
- String Operators
- Incrementing/Decrementing Operators
- Array Operators
- Assignment Operators
Operators in php
Operators | Additional Information | Associativity |
---|---|---|
clone new | clone and new | non-associative |
[ | array() | left |
** | arithmetic | right |
++ -- ~ (int) (float) (string) (array) (object) (bool) @ | increment/decrement and types | right |
instanceof | types | non-associative |
! | logical (negation) | right |
* / % | arithmetic | left |
+ - . | arithmetic and string concatenation | left |
<< >> | bitwise (shift) | left |
< <= > >= | comparison | non-associative |
== != === !== <> | comparison | non-associative |
& | bitwise AND | left |
^ | bitwise XOR | left |
| | bitwise OR | left |
&& | logical AND | left |
|| | logical OR | left |
?: | ternary | left |
= += -= *= **= /= .= %= &= |= ^= <<= >>= => | assignment | right |
and | logical | left |
xor | logical | left |
or | logical | left |
, | many uses (comma) | left |
Google Advertisment