OperatorNameDescription
+AddSum of 2 operand (left operand + right operand)
-SubtractDifference of 2 operands (left operand – right operand)
*MultiplyProduct of 2 operands (left operand * right operand)
/DivisionQuotient of 2 operands (left operand / right operand)
%ModulusRemainder of division when one operand is divided by other
- OperandNegationOpposite of operand
.ConcatenationCombine 2 strings into one.


<?PHP
	echo "Addition","\n", 1 + 2, "<br>";
	echo "Subtract","\n", 2 - 1, "<br>";
	echo "Multiplication","\n", 2 * 3, "<br>";
	echo "Division","\n", 4 * 2, "<br>";
	echo "Modulus","\n", 5 % 3, "<br>";
	echo "Negation","\n", -3, "<br>";
	echo "Concatenation","\n", "wel"."come", "<br>";
?>





















OperatorsHow they are used
a = ba = b
a += ba = a + b
a -= ba = a + b
a *= ba = a * b
a /= ba = a / b
a %= ba = a % b


<?php

$a = 1;
$b = 2;

$a = $b;
echo $a,"\n";

$a += $b;
echo $a,"\n";

$a -= $b;
echo $a,"\n";

$a *= $b;
echo $a,"\n";

$a /= $b;
echo $a,"\n";

$a %= $b;
echo $a,"\n";
?>







OperatorsDescription
++xThis operator increments the value of variable by one and then returns it.
x++This operator returns the variable and then increments it by one.
--yThis operator decrements the value of variable by one and then returns it.
y--This operator returns the variable and then decrements it by one.



<?php
$var = 4;
echo ++$var;
echo $var++;
echo --$var;

echo $var--;
?>



















OperatorsDescription
a == bChecks if value of a is equal to value of b even if data type is different then this expression returns true else returns false.
a === bChecks if value of a is equal to value of b and data type of both the operands are same then this expression returns true else false
a != b Or a <> bIf value of a is not equal to value of b then this expression returns true else false.
a !== bIf value of a is not equal to value of b or data type of a is not equal to data type of b then this expression returns true else false.
a > bIf value of a is greater than value of b then this expression returns true else false.
a < bIf value of a is greater than or equal to value of b then this expression returns true else false.
a >= bIf value of a is less than or equal to value of b then this expression returns true else false.
a <= bThis operator decrements the value of variable by one and then returns it.







OperatorsNameDescription
x and y / x && yAndTrue of both x and y are true
x or y / x || yOrTrue if either one or both is true
x xor yXorTrue if either one is true but not both
!xNotTrue if x is not true





Posted By  -  Karan Gupta
 
Posted On  -  Sunday, May 19, 2013

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250