0

Why b= 2 when $a=2; $b = $a++;

As we know a++ stands for a=a + ;

27th May 2019, 9:04 AM
Krishnadev Thakur
Krishnadev Thakur - avatar
1 Respuesta
+ 5
b = a++ means: assign the "old" value of a (2) to b, then increment a => a = 3, b = 2. b = ++a means: increment a, then assign its new value to b => a = 3, b = 3.
27th May 2019, 9:06 AM
Anna
Anna - avatar