PHP  Operators
Operators are used to perform operation on a single operand or two operands. Operators in PHP can be categorized as follows:
 Arithmetic operators
 Assignment operators
 Comparison operators
 Increment/Decrement operators
 Logical operators
 Bitwise operators
 Conditional (or Ternary) operators
Arithmetic operators
Arithmetic operators are used to perform arithmetic operations on two operands.
Operator  Name  Description 

+  Addition  Add two values 
  Subtraction  Subtract one value from another 
*  Multiplication  Multiply two values 
/  Division  Divide one value by another 
**  Exponent / Power  Returns first operand raised to the power of second operand 
%  Modulus  Returns remainder of integer division 
Example
Assignment operators
Assignment operators are used to assign values of right hand side expression to left hand side operand.
Operator  Expression  Equivalent to  Example 

=  a = 5  a = 5  Example 
+=  a += b  a = a + b  
=  a = b  a = a  b  
*=  a *= b  a = a * b  
/=  a /= b  a = a / b  
**=  a **= b  a = a ** b  
%=  a %= b  a = a % b  
&=  a &= b  a = a & b  More Info 
=  a = b  a = a  b  More Info 
^=  a ^= b  a = a ^ b  More Info 
>>=  a >>= b  a = a >> b  More Info 
<<=  a <<= b  a = a << b  More Info 
Comparison operators
Comparison operators are used to compare values of two operands. It returns true when values matches and false when values doen not match.
Operator  Description 

==  Equal: Checks the values of two operands and returns true if they are same. 
!=  Not equal: Checks the values of two operands and returns true if they are not same. 
<>  
===  Identical: Checks the values and datatypes of two operands and returns true if they are same. 
!==  Not identical: Checks the values and datatypes of two operands and returns true if they are not same. 
>  Greater than: Checks the values of two operands and returns true if the value of first operand is greater than the value of second operand. 
<  Less than: Checks the values of two operands and returns true if the value of first operand is less than the value of second operand. 
>=  Greater than or equal to: Checks the values of two operands and returns true if the value of first operand is greater than or equal to the value of second operand. 
<=  Less than or equal to: Checks the values of two operands and returns true if the value of first operand is less than or equal to the value of second operand. 
<=>  Spaceship: Checks the values of two operands and returns values based on the values of two operands:

Example
Increment/Decrement operators
Increment and decrement operators are used to increase and decrease the value of variable.
Operator  Name  Description  Example 

++$x  Preincrement  Increases the value of $x by 1, then returns $x.  Example 
$x++  Postincrement  Returns $x, then increases the value of $x by 1.  
$x  Predecrement  Decreases the value of $x by 1, then returns $x.  Example 
$x  Postdecrement  Returns $x, then decreases the value of $x by 1. 
Logical operators
Logical operators are used to combine two or more conditions.
Operator  Name  Description 

and  AND  Returns true when all conditions are true 
&&  
or  OR  Returns true when any of the conditions is true 
  
xor  Exclusive OR  Returns true when any of the conditions is true, but not both 
!  NOT  Returns true when the given conditions is not true 
More Info
Bitwise operators
Bitwise operators are used to perform bitwise operations on two operands.
Operator  Name  Description  More Info 

&  AND  Returns 1 if both bits at the same position in both operands are 1, else returns 0  More Info 
  OR  Returns 1 if one of two bits at the same position in both operands is 1, else returns 0  More Info 
^  XOR  Returns 1 if only one of two bits at the same position in both operands is 1, else returns 0  More Info 
~  NOT  Reverse all the bits  More Info 
>>  Right shift  The left operand is moved right by the number of bits present in the right operand  More Info 
<<  Left shift  The left operand value is moved left by the number of bits present in the right operand  More Info 
Conditional (or Ternary) operators
The conditional (or ternary) operators are used to set a value depending on conditions.
Operator  Name  Example 

?:  Ternary  $x = exp1 ? exp2 : exp3

??  Null coalescing  $x = exp1 ?? exp2
