Bug #10332 Updated: XOR logical doesnt work properly

From: Date: Sat, 28 Apr 2001 23:32:43 +0000
Subject: Bug #10332 Updated: XOR logical doesnt work properly
Groups: php.dev 
Request: Send a blank email to php-dev+get-52810@lists.php.net to get a copy of this message
ID: 10332 Updated by: elixer Reported By: laurent_tourreau@ifrance.com Status: Open Bug Type: Scripting Engine problem PHP Version: 4.0.4pl1 Assigned To: Comments: 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 Previous Comments: --------------------------------------------------------------------------- [2001-04-15 05:39:10] laurent_tourreau@ifrance.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. --------------------------------------------------------------------------- ATTENTION! Do NOT reply to this email! To reply, use the web interface found at http://bugs.php.net/?id=10332&edit=2

« previous php.dev (#52810) next »