Assignment Operators in Hindi
Assignment Operators के लिए '=' operator का इस्तेमाल किया जाता है |
Assignment Operators पांच प्रकार के होते है |
Operators | For Example | Description |
---|---|---|
= | a = b | Assignment Operator |
+= | a += b or a = a + b | Add Assignment Operator |
-= | a -= b or a = a - b | Subtract Assignment Operator |
*= | a *= b or a = a * b | Multiply Assignment Operator |
/= | a /= b or a = a / b | Divide Assignment Operator |
%= | a %= b or a = a % b | Modulus Assignment Operator |
Example = (Assignment Operator)
Source Code :Output :123456<?php
$a = 5;
$b = $a;
echo "Value of a : ".$a. "<br />";
echo "Value of b : ".$b;
?>
Value of a : 5
Value of b : 5
Example += (Add Assignment Operator)
Source Code :Output :123456<?php
$a = 5;
$b = 10;
$a += $b; // a = a + b;
echo "Value of a : ".$a;
?>
Value of a : 15
Example -= (Subtract Assignment Operator)
Source Code :Output :123456<?php
$a = 5;
$b = 10;
$a -= $b; // a = a - b;
echo "Value of a : ".$a;
?>
Value of a : -5
Example *= (Multiply Assignment Operator)
Source Code :Output :123456<?php
$a = 5;
$b = 10;
$a *= $b; // a = a * b;
echo "Value of a : ".$a;
?>
Value of a : 50
Example /= (Divide Assignment Operator)
Source Code :Output :123456<?php
$a = 5;
$b = 10;
$a /= $b; // a = a / b;
echo "Value of a : ".$a;
?>
Value of a : 0.5
Example %= (Modulus Assignment Operator)
Source Code :Output :123456<?php
$a = 5;
$b = 10;
$a /= $b; // a = a % b;
echo "Value of a : ".$a;
?>
Value of a : 5
0 comments:
Post a Comment
Thanks