PHP concatenation precedence
First of all, it is correct, and if it would be different it would also be correct, that's how PHP developers defined operand precedence.
In this scenario, no operand has precedence, so u read it left to right
'-' . 1 ==> '-1'
'-1' + 1 ==> 0
(arithmetic operations on strings, will try to cast them to numbers first and then do the arithmetics).0 . ' crazy cats' ==> "0 crazy cats"
(strings operations on numbers, will cast them to strings).
If you want -2 crazy cats, you can set the manipulate precedence with parenthesis:
echo '-' . (1 + 1) . ' crazy cats';
echo
also follows the construct of echo 'foo', 'bar'
which separates the items into distinct statements to echo. You don't have to worry about concatenation order in that case.
So you could do <?php echo '-', (1 + 1), ' crazy cats'; ?>
and your cats wouldn't care about negatives!