note 114500 deleted from language.operators.precedence by cmb
| From: | cmb@php.net | Date: | Thu, 07 Jul 2016 18:41:22 +0000 |
| Subject: | note 114500 deleted from language.operators.precedence by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-205919@lists.php.net to get a copy of this message | ||
Note Submitter: Antistone
----
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.)