#10332 [Com]: XOR logical doesnt work properly
| From: | FACIAL-EXCLUSIVE358 at hotmail dot com | Date: | Tue, 20 Jul 2004 15:00:51 +0000 |
| Subject: | #10332 [Com]: XOR logical doesnt work properly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-62789@lists.php.net to get a copy of this message | ||
ID: 10332
Comment by: FACIAL-EXCLUSIVE358 at hotmail dot com
Reported By: laurent_tourreau at ifrance dot com
Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Slackware 7.1 Linux 2.2.16
PHP Version: 4.0.4pl1
New Comment:
<a href=http://www.geocities.com/fghglydgv7410/>EXCLUSIVE
FACIAL</a>
Previous Comments:
------------------------------------------------------------------------
[2001-04-28 19:32:43] elixer@php.net
The "==" has higher precedence than does "xor," so evaluating left to
right we have:
$h == 4 xor $i == 5 xor $j == 6
or:
true xor true xor true
then:
false xor true
and finally:
true
which is true, which is expected behavior. Use parens to group the
exressions to get the results you are looking for.
Sean
------------------------------------------------------------------------
[2001-04-15 05:39:10] laurent_tourreau at ifrance dot com
<?php
$h = 4; $i =5, $j=6;
if ($h == 4 xor $i == 5 xor $j == 6) {
echo ("The condition is true");
}
else {
echo ("The condition is false");
}
?>
When i run it, i obtain The condition is true...
Im running PHP as Apache module.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=10332&edit=1