0

Php Operators Module 3 Quiz

Hello. I dont understand why in question: What is the value of $b? $a=2; $b=$a++; True answer is 2. My answer was 3 but its wrong.

12th May 2017, 11:22 AM
Владимир Богодист
Владимир Богодист - avatar
3 ответов
+ 1
Hello man, In any module quiz, there the is a comment section at the bottom left. People usually give explanations of the answer there. Check it out to find why it is 2 and not 3.
12th May 2017, 12:29 PM
CHMD
CHMD - avatar
+ 1
Consider thinking about the difference between pre-increment (++$a) and post-increment ($a++).
12th May 2017, 1:19 PM
Álvaro
0
The increment is not with the variable "B". Rather it is incrementing "A" after assigning 2 to variable "B". So, "A" is 2. "B" is assigned, Then "A" is incremented, not "B".
26th Jul 2020, 7:18 AM
Bruno
Bruno - avatar