+ 5

How can I print an operation of two variables in PHP?

I have already tried echo "The result is $(($num1 + $num2)) ..... isn't working.

20th Sep 2020, 1:53 PM
Anurag Mondal
Anurag Mondal - avatar
7 Respostas
+ 8
<?php $sum1 = 10; $sum2 = 10; echo $sum1 + $sum2; echo "<br>"; echo $sum1 * $sum2; echo "<br>"; echo $sum1 - $sum2; echo "<br>"; echo $sum1 % $sum2; ?>
20th Sep 2020, 2:24 PM
ㅀㅀㅀ
20th Sep 2020, 2:30 PM
Anurag Mondal
Anurag Mondal - avatar
+ 4
Owh..okay..thanks.
20th Sep 2020, 3:32 PM
Anurag Mondal
Anurag Mondal - avatar
+ 2
Please see how, here on a live example: https://code.sololearn.com/wdMg5lB9T43K/?ref=app
20th Sep 2020, 3:33 PM
JaScript
JaScript - avatar
+ 2
Remove the outer $()
21st Sep 2020, 10:32 PM
Sonic
Sonic - avatar
0
print(5_3)
21st Nov 2020, 8:52 PM
rdwan adm
rdwan adm - avatar