Re: 2 errors I can not understand

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ford, Mike wrote:
On 14 March 2007 22:52, Richard Lynch wrote:

On Wed, March 14, 2007 6:52 am, Myron Turner wrote:
Richard Lynch wrote:
On Tue, March 13, 2007 6:04 pm, Jonathan Kahan wrote:
The = operator takes precedence, and $d is set to 0.

But why?  According to the manual, the modulus operator has
precedence over the equals!  So shouldn't this expression  resolve
to:    ($s % $d) = 0 which gives an error?
Ya got me there.

I hadn't even checked the precedence list before answering.

Unless somebody has a rational explanation, I think this should be an
error...

When a similar anomaly involving the ! operator was reported (http://bugs.php.net/bug.php?id=17180), the response was that PHP is "smart" about such things and invokes the DWIM principle to silently alter the precedence of = in certain situations.  This resulted in the addition of a note to the end of the operator precedence page at http://uk2.php.net/manual/en/language.operators.php#language.operators.precedence, but it seems to me that this is too specific to the ! operator and should be generalized.  In fact, I'd completely forgotten that I suggested as much at the end of the bug report -- but this hasn't been taken up, so maybe a bunch of you want to re-activate the bug report and support my suggestion??

Cheers!

Mike

I've submitted a bug report with respect to this: http://bugs.php.net/bug.php?id=40820.

--

_____________________
Myron Turner
http://www.room535.org
http://www.bstatzero.org
http://www.mturner.org/XML_PullParser/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux