note 119561 rejected from language.operators.precedence by cmb
| From: | cmb@php.net | Date: | Thu, 07 Jul 2016 17:21:40 +0000 |
| Subject: | note 119561 rejected from language.operators.precedence by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-205917@lists.php.net to get a copy of this message | ||
Note Submitter: toshkent at mail dot ru
----
It seems to me that Anistone's note is not correct. The precedence of addition, subtraction,
and string concatenation depends on how the engine treats operands.
<?
$x = 4;
echo "2" . $x+1 . ", or so I hope"; //25, or so I hope
?>
But if we change the first operand "2" to "2p" or even "2 " (with
backspace) the engine recornizes it as a string and concatenation has higher priority (similar to
Anistone's example).
<?
$x = 4;
echo "2p" . $x+1 . ", or so I hope"; //3, or so I hope
?>