I have the following code:
<?php
$a = 1;
$b = 2;
echo "sum: " . $a + $b;
echo "sum: " . ($a + $b);
?>
When I execute my code I get:
2
sum: 3
Why does it fail to print the string "sum:"
in the first echo? It seems to be fine when the addition is enclosed in parentheses.
Is this weird behaviour anywhere documented?
Question&Answers:os