Re: php compiler

From: Date: Mon, 01 Nov 2004 02:29:16 +0000
Subject: Re: php compiler
References: 1 2 3 4 5 6 7 8 9  Groups: php.general 
Request: Send a blank email to php-general+get-200798@lists.php.net to get a copy of this message
* Thus wrote Hodicska Gergely: > Hi! > > > 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). > > Yes, this behaviour confused me. This is not common in other programming > languages: > o C : invalid lvalue in assignment > o Java : required: variable > found : value > o JavaScript: invalid assignment left-hand side (Mozilla) > syntax error (Internet explorer) > > But for me it isn't egxactly clear how the evaluation order was > calculated (why doesn't the first = operator executed before &&). Does > anybody know for example a flowchart, how it is implemented in PHP? I kind of hinted in my earlier what is going on but: $a = 1 && $b = 0; Is first silently evaluated as: $a = (1 && $b = 0); Now we test the left and right expressions of &&. The left expression is true. So the right expression is tested which happens to be ($b = 0). Curt -- Quoth the Raven, "Nevermore."

« previous php.general (#200798) next »