.
Operator
- Arithmetic Operator
- Assignment Operator
- Logical Operator
- Comparison Operator
- Conditional Operator
- Increment / Decrement Operator
- Concatenation Operator
Assignment |
Same As |
Description |
x = y |
x = y |
left operand
and right operand are same. |
x + = y |
X = X + y |
left operand get added
value of right
operand. |
x - = y |
x = x - y |
left operand get subtracted value
of right operand. |
x * = y |
x = x * y |
left operand
get multiplication value
of right operand. |
x / = y |
x = x / y |
left operand get divide
of value of right operand. |
x % = y |
x = x % y |
left operand get Remainder of value of right operand. |
Operator |
Name |
Example |
Description |
&& |
Logical AND |
x && y |
True if both x & y are true. |
|| |
Logical OR |
x || y |
True if one of them is true. False if both x & y are false. |
! |
Logical NOT |
! x |
True if x is false. |
and |
Logical AND |
x and y |
True if both operands are true. |
OR |
Logical OR |
x or y |
True if either one operand is true. |
Operator |
Name |
Example |
Result |
== |
Equal |
x == y |
return true x is equal |
=== |
Identical |
x === y |
x & y are same |
!= |
Not equal |
x!= y |
x is not equal to y |
!== |
Not identical |
x!==y |
x is not equal to same y |
> |
Greater than |
x>y |
True x is greater than y |
< |
Less than |
x<y |
True y is less than x |
>= |
Greater than & equal |
x>=y |
True x is greater equal to y |
<= |
Less than & equal |
x<y |
True y is less equal to x |
Operator |
Name |
Description |
++a |
Pre-increment |
Increment by 1 & return. |
a++ |
Post-increment |
Return a then increment by 1. |
--a |
Pre-decrement |
Decrement by 1 & return. |
a-- |
Post-decrement |
Return a then decrement by 1 |
Operator |
Name |
Example |
Result |
. |
Concatenation |
$a.$b |
Concatenation of $a & $b |
.= |
Concatenation |
$a.=$b |
Appends $a to $b |
Variable
Variable are like container which are the name of the memory location were the value are stored.
- A variable stats with $ sign followed bu variable name.
- A variable name must start with letter or underscore but cannot start with number.
- Variable name can only contain alphabetic characters and underscore (A-Z, 0-9, - ).
- Variable name is case-sensitive ($age, $AGE are different).
Comments
Post a Comment