From: [EMAIL PROTECTED] Operating system: PHP version: 4.2.0 PHP Bug Type: Scripting Engine problem Bug description: Operator Precedence
Why & How this code will work? <? function foo($flag) { return $flag; } $a=TRUE; echo "if (!\$a = foo(FALSE))) is "; if (!$a = foo(FALSE)) echo "true"; else echo "false"; echo "\n"; var_dump($a); echo "\n"; ?> Output: if (!$a = foo(FALSE))) is true bool(false) http://www.php.net/manual/en/language.operators.php "Operator Precedence" `!` has more precedence than `=` And after `!` we must have boolean constant in left side: FALSE = foo() Explain to me pls that I do not understand P.S. in C & Perl (!$a = foo()) is not valid expression -- Edit bug report at http://bugs.php.net/?id=17180&edit=1 -- Fixed in CVS: http://bugs.php.net/fix.php?id=17180&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=17180&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=17180&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=17180&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=17180&r=support Expected behavior: http://bugs.php.net/fix.php?id=17180&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=17180&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=17180&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=17180&r=globals