0
Why b= 2 when $a=2; $b = $a++;
As we know a++ stands for a=a + ;
1 Odpowiedź
+ 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.
As we know a++ stands for a=a + ;