note 32054 deleted from language.operators by sniper
| From: | sniper@php.net | Date: | Mon, 13 Oct 2003 00:05:32 +0000 |
| Subject: | note 32054 deleted from language.operators by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58368@lists.php.net to get a copy of this message | ||
Note Submitter: jsorrell at ubiqinc dot com
----
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.