ID:          17180
 Comment by:  [EMAIL PROTECTED]
 Reported By: [EMAIL PROTECTED]
 Status:      Closed
 Bug Type:    Documentation problem
 PHP Version: 4.2.0
 New Comment:

There seems to be a more general principle at work here -- see, for
example, related bug report 17386
(http://bugs.php.net/bug.php?id=17386).

Would it be true to say something like: when an assignment operator
occurs in a position where the usual rules of precedence would produce
a parse error, the precedence of the assignment is artificially
increased to allow the expression to parse; this usually gives the
intended result.

Cheers!

Mike


Previous Comments:
------------------------------------------------------------------------

[2003-01-18 16:14:46] [EMAIL PROTECTED]

This has now been documented:
http://cvs.php.net/cvs.php/phpdoc/en/language/operators.xml

Thanks for the report :)

------------------------------------------------------------------------

[2002-05-16 13:27:03] [EMAIL PROTECTED]

Marking this as a doc problem.

------------------------------------------------------------------------

[2002-05-14 13:46:58] [EMAIL PROTECTED]

Actually this is a bug, since in PHP manual it's clearly stated that !
operator has a priority over = operator.

> It makes no sense to assign anything to NOT(a variable),
> so PHP takes care of that by
> changing the precedence a little in this case.

In other words - if user makes a mistake and writes illegal code, PHP
takes care about that and makes this code work (but in a way different
from what developer has expected).

Also if you consider any other programming languages,
if you write a code which should not compile by language specifications
(like the above code in PHP), no compiler will try to "take care" of
that.

If you insist on that "care", then you definetely have to reflect that
in the manual, otherwise it's nothing but a bug.

------------------------------------------------------------------------

[2002-05-13 18:30:31] [EMAIL PROTECTED]

This behaviour is capable to confuse the developer and if this is
"features" it must be documented in manual.

------------------------------------------------------------------------

[2002-05-13 18:20:14] [EMAIL PROTECTED]

Well, but it's stupid to do something like that. It makes no sense to
assign anything to NOT(a variable), so PHP takes care of that by
changing the precedence a little in this case.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/17180

-- 
Edit this bug report at http://bugs.php.net/?id=17180&edit=1


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

Reply via email to