Re: php compiler

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

 



Hodicska Gergely wrote:
Oke, but && has a higher precedence. The "right " associativity has sense when all the operand has the same precedence.

I think the precedence of left and right associative operands can't be compared. The switch between associativities already separates the expression (if it could be explained this way). So you have to handle "left-evaluated" expressions and "right-evaluated" expressions separately. That's why "$b = 0" and "1 && $b" are evaluated separately.


The PHP manual gives a fine example: "Note: Although ! has a higher precedence than =, PHP will still allow expressions similar to the following: if (!$a = foo()), in which case the output from foo() is put into $a."

And that's because "=" is "right" and "!" is "non-associative".

--
Bye, K <http://www.ailis.de/~k/> (FidoNet: 2:240/2188.18)
[A735 47EC D87B 1F15 C1E9  53D3 AA03 6173 A723 E391]
(Finger k@xxxxxxxx to get public key)

Attachment: signature.asc
Description: OpenPGP digital signature


[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