Php Operator

To perform any operation with any operand or more than one operands know as operators

Arithmetic Operators

Operator Description
+ Addition.
- Subtracts
* Multiplication
/ Division
% Modules

Comparison Operators

Operator Description
== Checks if the value of two operands are equal or not, if yes then condition becomes true.
!= Checks if the value of two operands are equal or not, if values are not equal then condition becomes true.
> Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.
< Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true.
>= Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.
<= Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.

Logical (or Relational) Operators

Operator Description
and Called Logical AND operator. If both the operands are true then condition becomes true.
or Called Logical OR Operator. If any of the two operands are non zero then condition becomes true.
&& Called Logical AND operator. If both the operands are non zero then condition becomes true.
|| Called Logical OR Operator. If any of the two operands are non zero then condition becomes true.
! Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false.

Assignment Operators

Operator Description
= Simple assignment operator, Assigns values from right side operands to left side operand
+= Add AND assignment operator, It adds right operand to the left operand and assign the result to left operand
-= Subtract AND assignment operator, It subtracts right operand from the left operand and assign the result to left operand
*= Multiply AND assignment operator, It multiplies right operand with the left operand and assign the result to left operand
/= Divide AND assignment operator, It divides left operand with the right operand and assign the result to left operand
%= Modulus AND assignment operator, It takes modulus using two operands and assign the result to left operand

Conditional (or ternary) Operators

Operator Description
? : Conditional Expression