Breaking

LightBlog

Saturday 4 July 2015

PHP Operator



Introduction of Operator: Operator is the symbols that are used to perform the various operations on the operand .such as                                
                                 A + b * c
It can perform the various operation like arithmetic operations, comparison or logical operations etc..it refer to a symbol that tells the computer to perform certain mathematical or logical tasks on operands .Operators can be unary and Binary .Unary operators work on on operand like – a, b++ etc Binary operators work on the operators like a+b,  a*c.

                       
php operator

Arithmetic Operators: This is used perform the arithmetic Operators on the operand such as +, * ,/ ,-,%

Name
Symbol 
Addition
+
Subtraction
-
Multiplication
*
Division
/
Modulus
%


Logical  Operators .It used when we want to test more than one condition to make decisions .The result of logical operator AND will be true only if both conditions are true and OR will be true if one or more conditions are true .

Name
Symbol
AND
&&
OR
||
NOT
!

Assignment Operators:-It is used to assign value to the variable .Value can be any constant Value or evolution of an Expression .eg                                                           
a = 5;
Some Assignment Operator are given below:
Operator
Example
+=
X+=6
*=
A*=12
/=
a/=11
-=
z-=3
%=
Z%=2


Relational Operators: this Operators are used to check the relation between two operands .These are use to compare the two different operand and then take decisions they compare such operand is greater ,less or equal of another operand  eg

                                              A > b

Name
Symbol
Greater than
Less than
Equal
==
Greater than equal
>=
Less than equal
<=
Not equal
!=


Increment /Decrement Operator : The Increment Operator increase the values of and operand by 1 and add the 1 value in current value and Decrement  decrease the value of and operand by 1 means subtract the 1 value from current value

1.      Increment (++)
2.      Decrement (--)

Adbox