+ 4

How is this the output of the code

How is this the output of the code https://code.sololearn.com/wDgV4FWh2g9E/?ref=app

17th Sep 2020, 1:24 PM
Ndeanaefo Chidalu
Ndeanaefo Chidalu - avatar
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/
17th Sep 2020, 1:33 PM
Jaydeep Khatri
Jaydeep Khatri - avatar