note 119561 added to language.operators.precedence
| From: | toshkent at mail dot ru | Date: | Wed, 06 Jul 2016 20:16:33 +0000 |
| Subject: | note 119561 added to language.operators.precedence | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205911@lists.php.net to get a copy of this message | ||
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
?>
----
Server IP: 72.52.91.14
Probable Submitter: 78.132.227.15
----
Manual Page -- http://php.net/manual/en/language.operators.precedence.php
Edit -- https://master.php.net/note/edit/119561
Del: integrated -- https://master.php.net/note/delete/119561/integrated
Del: useless -- https://master.php.net/note/delete/119561/useless
Del: bad code -- https://master.php.net/note/delete/119561/bad+code
Del: spam -- https://master.php.net/note/delete/119561/spam
Del: non-english -- https://master.php.net/note/delete/119561/non-english
Del: in docs -- https://master.php.net/note/delete/119561/in+docs
Del: other reasons-- https://master.php.net/note/delete/119561
Reject -- https://master.php.net/note/reject/119561
Search -- https://master.php.net/manage/user-notes.php