Assignment Operator:
We have used the basic assignment operator in our life but a confusion may occur between an "assignment operator" and "equal to ", though these seems same but in programming languages these are not.
In the following examples different types of assignment operators are described:
Example of PHP Assignment Operator:
<?php
$a
=($b=23)+12;echo
"Value of a is :".$a."<br/>";$a
+=34;echo
"Value of a is :".$a."<br/>";$a
-=34;echo
"Value of a is :".$a."<br/>";$a
/=34;echo
"Value of a is :".$a."<br/>";echo
"Value in integer data type of a is :".(int)$a."<br/>";$a
*=34;echo
"Value of a is :".$a."<br/>";$a
%=34;echo
"Value of a is :".$a."<br/>";echo
"Value of b is :".$b;?>
Output:
Value of a is :35
Value of a is :69
Value of a is :35
Value of a is :1.0294117647059
Value in integer data type of a is :1
Value of a is :35
Value of a is :1
Value of b is :23
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.