+ 4
How is this the output of the code
How is this the output of the code https://code.sololearn.com/wDgV4FWh2g9E/?ref=app
1 Answer
+ 6
The simplified code will be like
$a=1;
echo $a;
$a = $a+1;
$a = $a+1;
echo $a;
In post-increment returns the original value before it changes the variable, while the pre-increment changes the variable first and then return the value.
ref: https://www.sololearn.com/learn/PHP/1803/



