+ 6
Two identical codes with different outputs
Hello Why aren't outputs the same? https://code.sololearn.com/cz0145bf6vSr/?ref=app https://code.sololearn.com/w6o50b5dOsxR/?ref=app
3 ответов
+ 4
hosein Zarei
PHP is different than others language.
Here increment happens from right side means ++a first will be increment which will be 2 then $a += 2 now $a is 2 so $a = 2 + 2 = 4
in C#
a += ++a;
a = 1 + 2 = 3
https://code.sololearn.com/w07HrjxKNOct/?ref=app
+ 2
Languages has their own implementation in which operation will be done first. In a first glance it seems is the same code, but it is not.
+ 1
The fundamentals for both languages are the same but the implications are different