I have a doubt php of a chagenger | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

I have a doubt php of a chagenger

why this code outputs 13 and not 12? https://code.sololearn.com/wY7Jx06hhkG1/?ref=app I am new. Thank for your support!

9th Nov 2019, 8:25 PM
Zetra_coder
Zetra_coder - avatar
2 Answers
+ 3
++$x is called pre-increment operator. This means that first, 1 is added to x, and the result is then evaluated in the expression. On the right side x is incremented twice this way so it becomes (6+7)
9th Nov 2019, 8:42 PM
Tibor Santa
Tibor Santa - avatar
+ 2
I see, thank!!!
9th Nov 2019, 9:57 PM
Zetra_coder
Zetra_coder - avatar