+ 1

If I add 20+10a it shows 30 but for 20+a10 it shows 20 o.O why is this?

16th Apr 2016, 5:12 AM
Mohiuddin Sumon
Mohiuddin Sumon - avatar
2 ответов
+ 5
because u cant add integer and string but php try to convert that string into integer so if u hav a string name b having value "10 days" and u do echo $a+$b it will print 20 if $a having 10 value it ignore days or anythinh after that integer value so it works in ur case but didnt work when u hav any character follow by number
5th May 2016, 11:04 AM
Viren Dave
Viren Dave - avatar
- 2
because in a10, "a" is a string and place on before of integer
4th May 2016, 9:08 PM
Rahul Vyas
Rahul Vyas - avatar