Changes

PHP Operators

367 bytes added, 13:28, 31 May 2007
PHP Logical Operators
if (($var1 < 25) || ($var2 > 45)
echo 'Our expression is true';
 
</pre>
 
Another useful logical operator is the ''Exclusive Or'' (XOR) operator. The XOR operator returns true if only one of the expressions evaluates to be true. For example:
 
''If $var is EITHER less than 25 OR greater than 45 display a message''
 
We represent XOR with the keyword ''xor'':
 
<pre>
 
if (($var1 < 25) xor ($var2 > 45)
echo 'Our expression is true';