|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10332 XOR logical doesnt work properly
Submitted: 2001-04-15 05:39 UTC Modified: 2001-04-28 19:33 UTC
From: laurent_tourreau at ifrance dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.0.4pl1 OS: Slackware 7.1 Linux 2.2.16
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: laurent_tourreau at ifrance dot com
New email:
PHP Version: OS:


 [2001-04-15 05:39 UTC] laurent_tourreau at ifrance dot com
	$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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-04-28 19:32 UTC]
The "==" has higher precedence than does "xor," so evaluating left to right we have:

$h == 4 xor $i == 5 xor $j == 6
true xor true xor true
false xor true
  and finally:
  which is true, which is expected behavior.  Use parens to group the exressions to get the results you are looking for.

PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Mon Oct 22 18:01:25 2018 UTC