Operators are very small commands that work with variables and perform tasks:

Operator Description Example Result
+ Addition 2+3 5
subtraction 3-2 1
/ division 6/2 3
* multiplication 3*4 12
% division remainder 7/3 1
++ increment by 1 $x=4;    $x++; $x=5;
Decrement by 1 $x=4;    $x–; $x=3;
Operator Example The Same as
= $a=$b; $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;
Operator Description Example
=== Are they absolutely the same $a===$b assuming $a=1 and $b=”1″ result is false
== Are they equal $a==$b assuming $a=1 and $b=”1″ result is true
!= Not equal $a!=$b assuming $a=1 and $b=2 result is true
<> Not equal $a<>$b assuming $a=1 and $b=1 result is false
> is greater $a>$b assuming $a=3 and $b=2 result is true
< is smaller $a<$b assuming $a=3 and $b=2 result is false
>= is greater or equal $a>=$b is true for $a=4 and $b=4 or $b=3
<= is smaller or equal $a<=$b is true for $a=4 and $b=4 or $b=5
Operator Description Example

&&

and

It is true if both are true

$a==5 && $b==7 returns true

$a==4 && $b==7 returns false

||

or

It is true if even one is true

$a==5 || $b==7 returns true

$a==4 || $b==7 returns true

$a==4 || $b==8 returns false

! It is true if it is false and if it is false it is true

!(true) returns false

!(false) return true

Assuming $a=5 and $b= 7

There are other operators availible in PHP but discussing them is out of the present scope of this basic tutorial at this time. You can find more about operators here