Concatenation doesn’t work with addition and subtraction? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
0

Concatenation doesn’t work with addition and subtraction?

It works with multiplication and division, though. What am I doing wrong? https://code.sololearn.com/w9oUC7NfdxMP/?ref=app

18th Oct 2018, 11:10 AM
Nat√°lia Klenovsk√°
2 Respostas
+ 6
Operator will be in double quotes and before and after that (.) will be used https://code.sololearn.com/wz9Jl2a2bb5Y/?ref=app
18th Oct 2018, 11:24 AM
GAWEN STEASY
GAWEN STEASY - avatar
0
Thanks for the fast reply, Gawen. With your answer I got an output ‚ÄúAddition: 4+7‚ÄĚ I would like to know: is it possible to echo a text with addition and have the *text and the result* as an output? It works with * and / <?php echo "Multiplication: ".$numA * $numZ.'<br />'; // output: Multiplication: 28 ?> However, I can‚Äôt get a result with concatenation and + and -. <?php echo "Addition: ".$numA + $numZ."<br />"; // output: 7 // instead of: Addition: 11 ?> Thanks
20th Oct 2018, 6:38 AM
Nat√°lia Klenovsk√°