note 32054 added to language.operators
| From: | jsorrell at rack1 dot php dot net | Date: | Wed, 14 May 2003 20:48:33 +0000 |
| Subject: | note 32054 added to language.operators | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-47991@lists.php.net to get a copy of this message | ||
Regarding the note by wikiz at studentas dot lt
I think PHP is doing a little sanity checking for you in the particular case you have presented.
The expression 10 + $b is not a valid lvalue, that is you CAN'T make the assignment:
(10 + $b) = 5
That's like trying the following assignment:
2 = 5
Since 10 + $b is an expression, it evaluates to a single returned value, in this case whatever the
sum of the variable $b and 10 is. So, rather than throw an error (which might be more appropriate)
PHP is doing the assignment first, since that is the only valid interpretation of the statement.
--
http://www.php.net/manual/en/language.operators.php
http://master.php.net/manage/user-notes.php?action=edit+32054
http://master.php.net/manage/user-notes.php?action=delete+32054
http://master.php.net/manage/user-notes.php?action=reject+32054