I started learning PHP not too long ago and I ran into this issue:
<?php
$a = 1;
$b = 2;
echo "$a * $b = " . $a * $b;
echo "<br />";
echo "$a / $b = " . $a / $b;
echo "<br />";
echo "$a + $b = " . $a + $b;
echo "<br />";
echo "$a - $b = " . $a - $b;
echo "<br />";
I get the following output:
1 * 2 = 2
1 / 2 = 0.5
3
-1
The last two lines in the output are not what I would expect.
Why is this? How are these expressions evaluated? I'm trying to get a better understanding of the language.