Operators are symbols
used in programming to perform an operation. Value operated by carriers that
are called operands or arguments with operators to form expressions.
1.
Assignment
Operators
Symbol
|
Example
|
=
|
$x=4
|
+=
|
$x+=4
|
-=
|
$x-=4
|
/=
|
$x/=4
|
%=
|
$x%=4
|
&=
|
$x&=4
|
!=
|
$x|=4
|
2.
Comparison Operators
Symbol
|
Example
|
==
|
$x==$y
|
<
|
$x<$y
|
>
|
$x>$y
|
<=
|
$x<=$y
|
>=
|
$x>=$y
|
!=
|
$x!=$y
|
3.
Arithmetic
Operators
Symbol
|
use
|
Example
|
+
|
Plus
|
$x+$y
|
-
|
Minus
|
$x-$y
|
*
|
Multiplication
|
$x*$y
|
/
|
Division
|
$x/$y
|
%
|
Modulo
|
$x%$y
|
++
|
Increment
|
$x++
|
--
|
Decrement
|
$y--
|
4.
Logic
Operator
Symbol
|
Example
|
And
|
If($x==0
and $y==1)
|
&&
|
If($x==0
&& $y==1)
|
Or
|
If($x==0
or $y==1)
|
|
|
|
If($x==0
| | $y==1)
|
XOR
|
If($x==0
xor $y==1)
|
!
|
If(!empty($x))
|
No comments:
Post a Comment