note 41230 added to language.operators.logical

From: Date: Sat, 03 Apr 2004 13:20:46 +0000
Subject: note 41230 added to language.operators.logical
Groups: php.notes 
Request: Send a blank email to php-notes+get-67559@lists.php.net to get a copy of this message
A lot of the discussion below could have been avoided simply by being clear that &, | and ^ are *not* logical operators. That's why they're not listed on this page. They're operators that act on the binary representations of numbers. They do not take logical values (i.e., "true" or "false") as arguments without first converting them to the numbers 1 and 0 respectively. Nor do they return logical values, but numbers. Sure, you can later treat those numbers as though they were logical values (in which case 0 is cast to "false" and anything else is cast to "true"), but that's a consequence of PHP's type casting rules, and nothing to do with the behaviour of the operators. If you want logical operations, use logical operators; if you want bitwise operations, use bitwise operators ... using one for the other seems like a good way to make things difficult. ---- Manual Page -- http://www.php.net/manual/en/language.operators.logical.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+41230 Delete -- http://master.php.net/manage/user-notes.php?action=delete+41230&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+41230&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#67559) next »