+ 4

Why the output is zero?

Question: $var = 'hello'; $car = 'world'; echo $var+$car; Why the output is zero here? Please can anyone explain me?

28th May 2020, 4:56 AM
Nikhil Maroju
Nikhil Maroju - avatar
3 Answers
+ 6
Because addition of string results in zero. You have to use dot(.) to concatenate two strings. $var = "hello"; $var2 = "world"; echo $var.$var2;
28th May 2020, 5:13 AM
Raj Chhatrala
Raj Chhatrala - avatar
28th May 2020, 10:01 AM
Nikhil Maroju
Nikhil Maroju - avatar
0
hhj
29th May 2020, 12:43 AM
Yacine Rafed
Yacine Rafed - avatar