Too add something ton Antistone's comment :
{Antistone ¶
1 year ago
BEWARE: Addition, subtraction, and string concatenation have equal precedence!
<?
$x = 4;
echo "x minus one equals " . $x-1 . ", or so I hope";
?>
will print "-1, or so I hope"
(Concatenate the first string literal and the value of $x, then implicitly convert that to a number (zero) so you can subtract 1 from it, then concatenate the final string literal.)
}
You can use the operator "," instead of ".".
This way allows you to concatenate the first string literal after $x-1.
So the first string literal is note convert to a number (zero) .
Solution :
<?php
$x = 4;
echo "x minus one equals " , $x-1 . ", or so I hope";
?>
will print :
"x minus one equals 3, or so I hope "