RE: 2 errors I can not understand

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

 



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

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm

-- 
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