# Php Operators

Operators are used to performing operations on two variable's values. there are various types of operators used in PHP.

• Arithmetic Operators
• Assignment Operators
• Comparison Operators
• Logical Operators
• Increment/Decrement Operators

## Arithmetic Operators

Operator Description Example Result
- Subtraction x=2 5-x 3
* Multipication x=4 x*5 20
/ Division 15/5 5/2 3 2.5
% Modulus 5%2 1

## Assignment Operators

Operator Example Is The Same As
= x=y x=y
+= x+=y x=x+y
-= x-=y x=x-y
*= x*=y x=x*y
%= x%=y x=x%y

## Assignment Operators

Operator Description Example
== Is equal to 5==8 returns false
!= Is not equal 5!=8 returns true
> Is greater than 5>8 returns false
< Is less than 5<8 returns true
>= Is greater than or equal to 5>=8 returns false
<= Is less than or equal to 5<=8 returns false

## Logical Operators

Operator Description Example
&& and x=6 y=3 (x<10 && y>1) returns true
|| or x=6 y=3 (x==5 || y==5) returns false
! not x=6 y=3 !(x==y) returns true

## Increment/Decrement Operators

Operator Description Example Result
++ Increment x=5 x++ x=6
-- Decrement x=5 x-- x=4