Re: 2 errors I can not understand
| From: | Myron Turner | Date: | Thu, 15 Mar 2007 12:58:59 +0000 |
| Subject: | Re: 2 errors I can not understand | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250655@lists.php.net to get a copy of this message | ||
Ford, Mike wrote:
On 14 March 2007 22:52, Richard Lynch wrote: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...On Wed, March 14, 2007 6:52 am, Myron Turner wrote:But why? According to the manual, the modulus operator has precedence over the equals! So shouldn't this expression resolveThe = operator takes precedence, and $d is set to 0.Richard Lynch wrote:On Tue, March 13, 2007 6:04 pm, Jonathan Kahan wrote:to: ($s % $d) = 0 which gives 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/