note 67010 added to language.operators.logical

From: Date: Fri, 02 Jun 2006 07:09:30 +0000
Subject: note 67010 added to language.operators.logical
Groups: php.notes 
Request: Send a blank email to php-notes+get-112894@lists.php.net to get a copy of this message
There actually IS an XOR operator symbol. Its the ^ symbol, which strictly speaking in boolean logic should be the OR operator. But in PHP it functions correctly as the XOR operator. <? $a = true; $b = false; $c = ($a ^ $b); echo $c; //returns 1 (boolean true) $a = true; $b = true; $c = ($a ^ $b); echo $c; //returns 0 (boolean false); ?> However, in testing the operator precedence for this I have found unhandled errors in the logic. For instance, the following returns neither true nor false. Perhaps this is not yet fully developed? <? error_reporting(E_ALL); $a = true; $b = true; $d = false; $c = ($a ^ $b || $d); echo $c; //RETURNS NOTHING ?> ---- Server IP: 64.71.164.2 Probable Submitter: 24.155.109.0 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/language.operators.logical.php Edit -- http://master.php.net/note/edit/67010 Del: integrated -- http://master.php.net/note/delete/67010/integrated Del: useless -- http://master.php.net/note/delete/67010/useless Del: bad code -- http://master.php.net/note/delete/67010/bad+code Del: spam -- http://master.php.net/note/delete/67010/spam Del: non-english -- http://master.php.net/note/delete/67010/non-english Del: in docs -- http://master.php.net/note/delete/67010/in+docs Del: other reasons-- http://master.php.net/note/delete/67010 Reject -- http://master.php.net/note/reject/67010 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#112894) next »