+ 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.
7 Answers
+ 13
You can do it like this (With String) 👇
༄ᶦᶰᵈ᭄⚔𝕌𝕛𝕛𝕒𝕨𝕒𝕝⚔ —͟͟͞͞𖣘 Right
https://code.sololearn.com/wO89C8Jc9FsL/?ref=app
+ 8
<?php
$sum1 = 10;
$sum2 = 10;
echo $sum1 + $sum2;
echo "<br>";
echo $sum1 * $sum2;
echo "<br>";
echo $sum1 - $sum2;
echo "<br>";
echo $sum1 % $sum2;
?>
+ 4
༄ᶦᶰᵈ᭄⚔𝕌𝕛𝕛𝕒𝕨𝕒𝕝⚔ —͟͟͞͞𖣘 It wasn't working inside a " " . Had to print it after a comma. Thanks.
+ 4
Owh..okay..thanks.
+ 2
Please see how, here on a live example:
https://code.sololearn.com/wdMg5lB9T43K/?ref=app
+ 2
Remove the outer $()
0
print(5_3)