$a=5; $b=4; echo "sum is".$a+$b; | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

$a=5; $b=4; echo "sum is".$a+$b;

Why there s an error.

20th Mar 2019, 5:08 PM
Afzal Ali
Afzal Ali - avatar
2 Answers
+ 4
Missing concantention Should be: echo "sum is" + $a + $b; (Add them up into one string to output)
20th Mar 2019, 5:22 PM
Gordon
Gordon - avatar
+ 3
Also works this way echo "sum is".($a+$b);
20th Mar 2019, 5:24 PM
Afzal Ali
Afzal Ali - avatar