What is the result of executing following code?
echo 'foo' . 42 + 'bar' . 'qwe';
Explanation

"+" and "." operators has the same priority. "+" operator converts string values to number, 'foo42' + 'bar' = 0;

Operations are performed in order from left to right. In addition, each time there is a types juggling:
1) 'foo' . 42 => 'foo' . '42' => 'foo42'
2) 'foo42' + 'bar' => 0 + 0 => 0
3) 0 . 'qwe' => '0' . 'qwe' => '0qwe'

Слідкуй за CodeGalaxy

Мобільний додаток Beta

Get it on Google Play
Зворотній Зв’язок
Продовжуйте вивчати
тести з PHP
Cosmo
Зареєструйся Зараз
або Підпишись на майбутні тести