I have seen a question on stack over flow. What's happening with this expression? b = a + (a = a + 5)
It shows the value of b will be 15. But when i run this code on Php, value of b is 20.
Why there is difference of output in php and C#
I have seen a question on stack over flow. What's happening with this expression? b = a + (a = a + 5)
It shows the value of b will be 15. But when i run this code on Php, value of b is 20.
Why there is difference of output in php and C#
It's happens because PHP and C# differently used memory for save variables.
Read How PHP manages variables.
So PHP not duplicated zval memory for variable "$a" and value of $a changed when ($a = $a +5)
has been completed so we have that
$a = 5;
echo $a + ($a = $a + 5); //20
and C# has duplicated memory for a
variables read answer What's happening with this expression? b = a + (a = a + 5).