What's b value | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's b value

$a=2 ; $b=$a++; Guys what is the answer of b

21st May 2020, 2:24 PM
Kumaresan
4 Answers
+ 1
That is because of post increment. Value of $a will be stored in $b and then it will increment. But if you use pre increment then it's a different story. Try this : $a = 2; $b = ++$a; echo $b;
21st May 2020, 2:33 PM
Raj Chhatrala
Raj Chhatrala - avatar
0
But b answer show 2 ....how 🤔
21st May 2020, 2:25 PM
Kumaresan
0
Sir answer 3 ...
21st May 2020, 2:42 PM
Kumaresan
0
Sir variable declare after the addition do not do it
21st May 2020, 2:45 PM
Kumaresan