- 1
Operators
What is the value of $b? $a=2; $b=$a++; why not 3?
3 odpowiedzi
+ 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😝😝
- 1
$а=2 $b=$a++;
????????????