note 65226 added to language.operators.bitwise
| From: | php-general at lists dot php dot net | Date: | Thu, 27 Apr 2006 07:31:55 +0000 |
| Subject: | note 65226 added to language.operators.bitwise | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-109824@lists.php.net to get a copy of this message | ||
For the sake of completeness I want to note that a check for equality doesn't have so long
winded as in the (wrong) example below. Because of simple laws of logic you don't have to check
every possible combination of the variables. The following code will be no surprise for most of you,
but for some people it could be helpful.
-Tim
<?php
$a = 42 ;
$b = 42 ;
$c = 1138 ;
$d = 1701 ;
echo $a==$b && $b==$c && $c==$d ? "equal" : "not equal" ; //
echoes not equal
$a = 42 ;
$b = 42 ;
$c = 42 ;
$d = 42 ;
echo $a==$b && $b==$c && $c==$d ? "equal" : "not equal" ; //
echoes equal
?>
----
Server IP: 217.160.72.57
Probable Submitter: 84.132.197.13
----
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.bitwise.php
Edit -- http://master.php.net/note/edit/65226
Del: integrated -- http://master.php.net/note/delete/65226/integrated
Del: useless -- http://master.php.net/note/delete/65226/useless
Del: bad code -- http://master.php.net/note/delete/65226/bad+code
Del: spam -- http://master.php.net/note/delete/65226/spam
Del: non-english -- http://master.php.net/note/delete/65226/non-english
Del: in docs -- http://master.php.net/note/delete/65226/in+docs
Del: other reasons-- http://master.php.net/note/delete/65226
Reject -- http://master.php.net/note/reject/65226
Search -- http://master.php.net/manage/user-notes.php