- 1

Operators

What is the value of $b? $a=2; $b=$a++; why not 3?

7th Jul 2018, 8:50 PM
Sagor Sandy
Sagor Sandy - avatar
3 Respostas
+ 1
Because with post increment($a++) value of $a is assigned to $b. Then if you echo it out, you will see that it is 3. So it first assigns value of $a to $b and then increments it. If there was ++$a, value would be 3, because it is PRE increment meaning it is incrementing and then assigning value. Hope this helped😝😝
7th Jul 2018, 9:00 PM
Sad
Sad - avatar
- 1
$а=2 $b=$a++; ????????????
26th Sep 2019, 12:29 PM
Saidorif Mulloev
Saidorif Mulloev - avatar