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
2 Réponses
+ 6
Operator will be in double quotes and before and after that (.) will be used
https://code.sololearn.com/wz9Jl2a2bb5Y/?ref=app
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