Date: 11/28/02
- Next message: Arnaud Limbourg: "[PHP-DOC] Re: [PEAR-DOC] Re: [PHP-DOC] Modules/Extensions not in 4.3"
- Previous message: john <email protected>: "[PHP-DOC] #15110 [Opn]: Sessions are not saved unless the session contains data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
ID: 17386
Updated by: john <email protected>
Reported By: m.ford <email protected>
Status: Open
Bug Type: Documentation problem
PHP Version: 4.1.2
Assigned To: john
New Comment:
I'll make the change for the associtivity from left to right, but I
don't know if I should just make a note of the example regarding
precedence rules.
Anyone know if its intended behavior, or should this have thrown a
parse error?
John
Previous Comments:
------------------------------------------------------------------------
[2002-05-23 09:34:04] m.ford <email protected>
The operators page at /manual/en/language.operators.php lists the the
assignment operators (=, +=, etc.) as being left associative, but they
must logically be right associative. Left associativity would mean that
this:
$a = $b = 0;
was interpreted as:
($a = $b) =0;
which is clearly nonsensical. Indeed a quick test shows that:
$d = $c += $a += $b += 4;
is interpreted as:
$d = ($c += ($a += ($b += 4)));
which looks like right associativity to me!
(Actually, a little further testing suggests that the assignment
operators need some special annotations, as they don't appear to
strictly obey their stated precedence level. For example, the
statement:
$x = $z + $y = 543;
if interpreted strictly according to the precedence rules should be
equivalent to:
$x = ($z + $y) = 543;
which would be a parse error, but in fact is interpreted as:
$x = $z + ($y = 543);
which may be the "obvious" intention, but had me WTF-ing for a while!!)
------------------------------------------------------------------------
-- Edit this bug report at http://bugs.php.net/?id=17386&edit=1-- PHP Documentation Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Arnaud Limbourg: "[PHP-DOC] Re: [PEAR-DOC] Re: [PHP-DOC] Modules/Extensions not in 4.3"
- Previous message: john <email protected>: "[PHP-DOC] #15110 [Opn]: Sessions are not saved unless the session contains data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

