ID: 45410 User updated by: ensnnet at gmail dot com Reported By: ensnnet at gmail dot com Status: Bogus Bug Type: Unknown/Other Function Operating System: windows xp sp3 PHP Version: 5.2.6 New Comment:
Sorry by I still I think something is wrong. Please take a while to see the next code (or run it on your machine): <?php $l1 = true; $l2 = false; $l1_and_l2 = $l1 and $l2; $l2_and_l1 = $l2 and $l1; echo "<pre>"; echo "Here l1 and l2 is: "; var_dump($l1 and $l2); echo "But here l1 and l2 is: "; var_dump($l1_and_l2); echo "And here l2 and l1 is: "; var_dump($l2_and_l1); echo "What happens?"; echo "</pre>"; ?> Previous Comments: ------------------------------------------------------------------------ [2008-07-02 21:32:31] [EMAIL PROTECTED] Please take a look at the examples on php.net/operators.logical ------------------------------------------------------------------------ [2008-07-02 19:03:39] [EMAIL PROTECTED] Please see the operator precedence table and explanation on the page I ahve given, somewhere in the upper area are "&&", "||" and so on, then "=" and in the bottom "and", "or", "xor" which means the assignment is done before the "and" operator is executed. For further questions please refer to other support forums, see http://php.net/support.php ------------------------------------------------------------------------ [2008-07-02 17:12:16] ensnnet at gmail dot com Thank for your answer [EMAIL PROTECTED] but still I think someone is not correct, perhaps I am wrong. I have read your link: http://es2.php.net/manual/en/language.operators.logical.php: And y read there: $a and $b => TRUE if both $a and $b are TRUE. I had writed another simple code that dont run as expected (I send you at the end of this note). The result that show on my computer is: $l1 = TRUE, $l2 = FALSE => $l1 and $l2 is FALSE $l1 = TRUE, $l2 = FALSE => $l1 and $l2 is TRUE $l1 = TRUE, $l2 = FALSE => $l1 and $l2 is FALSE $l1 = TRUE, $l2 = FALSE => $l1 and $l2 is FALSE I think the second line must be as the another lines. What is wrong? Thanks for your attention, jaz This is the code: <?php $v1 = "A"; $v2 = 0; $l1 = $v1=="A"; $l2 = $v2!=0; $flag1 = $l1 and $l2; $flag2 = ($l1 and $l2); $flag3 = $l2 and $l1; echo "\$l1 = ".showAstxt($l1).", \$l2 = ".showAstxt($l2)." => \$l1 and \$l2 is ".showAstxt($l1 and $l2)."<br>"; echo "\$l1 = ".showAstxt($l1).", \$l2 = ".showAstxt($l2)." => \$l1 and \$l2 is ".showAstxt($flag1)."<br>"; echo "\$l1 = ".showAstxt($l1).", \$l2 = ".showAstxt($l2)." => \$l1 and \$l2 is ".showAstxt($flag2)."<br>"; echo "\$l1 = ".showAstxt($l1).", \$l2 = ".showAstxt($l2)." => \$l1 and \$l2 is ".showAstxt($flag3)."<br>"; // ============================================================ function showAstxt($v) { return $v ? "TRUE" : "FALSE"; } ?> ------------------------------------------------------------------------ [2008-07-01 23:08:37] [EMAIL PROTECTED] sorry wrong URL, correct one: http://php.net/operators ------------------------------------------------------------------------ [2008-07-01 23:07:14] [EMAIL PROTECTED] Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php The assignment is executed before the "and" operator, see the precedence table in the docs, http://php.net/operator ------------------------------------------------------------------------ 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/45410 -- Edit this bug report at http://bugs.php.net/?id=45410&edit=1