note 67010 deleted from language.operators.logical by nlopess
| From: | nlopess@php.net | Date: | Fri, 02 Jun 2006 08:55:25 +0000 |
| Subject: | note 67010 deleted from language.operators.logical by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-112912@lists.php.net to get a copy of this message | ||
Note Submitter: sheppard dot daniel at gmail dot com
----
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
?>