PHP Operator is a symbol that tells the PHP processor to do certain actions. There are several operators used in PHP language, so we have separated them into the following categories to create it easier to learn them all.
In PHP have following operators, please see below point wise:
a) Arithmatic Operators
b) Assignment Operators
c) Comparison Operators
d) Increment/Decrement Operators
e) Logical Operators
f) String Operators
g) Array Operators
a) ARITHMATIC OPERATORS
PHP arithmetic operators used for numeric values to perform arithmetical operations, like addition, subtraction, multiplication, division, modulus etc.
Like : $a + $b, $a - $b, $a * $b, $a / $b, $a % $b
b) ASSIGNMENT OPERATORS
Assignment operator in PHP is "=". It means the left operand gets set the value of the assignment expression on the right.
|A = B + C will assign value of B + C into A|
|A += B is equivalent to A = A + B||(Addition) |
|A -= B same as A = A - B||(Substraction)|
|A *= B same as A = A * B||(Multiplication)|
|A /=B same as A = A / B||(Division)|
|A %=B same as A = A % B||(Modulus)|
c) COMPARISON OPERATORS
PHP comparison are compare to two values !!
|Operator ||Name of Operator||Example|
|==||Equal||$a == $b|
|!=||Not equal||$a != $b|
|<>||Not equal||$a <> $b|
|>||Greater than||$a > $b|
|<||Less than||$a <$b|
|>=||Greater than or equal to||$a >= $b|
|<=||Less than or equal to||$a <= $b|