PHP operatorsthis section lists the different operators used in PHP.
Arithmetic Operators
operatordescriptionexampleresult
| + |
addition |
x=2 x+2 |
4 |
| subtraction |
x=2 5-x |
* |
multiplication |
x=4 x*5 |
20 |
| |
division |
15/5 5/2 |
3 2.5 |
| % |
modulus (division remainder) |
5%2 10%8 10%2 |
1 2 0 |
| ++ |
increme NT |
x=6 |
| -- |
decrement |
x=5 x-- |
x=4 |
Assignment Operators
Operatorexampleis 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 |
| %= |
x%=y |
x=x%y |
Comparison operators
operatordescriptionexample
| is equal to |
!= |
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 |
<= |
|
logical Operators
Operatordescriptionexample
| && |
and |
X=6 Y=3 (x < ten && y > 1) returns True
|
|
Or |
X=6 Y=3 (x==5 y==5) returns false
|
| ! |
Not |
X=6 Y=3! (x==y) returns True
|
This article links http://www.cxybl.com/html/wlbc/Php/20120531/27128.html