Re: XOR or bit manupulation
| From: | Lars Torben Wilson | Date: | Sun, 03 Feb 2002 03:34:37 +0000 |
| Subject: | Re: XOR or bit manupulation | ||
| References: | 1 | Groups: | php.dev php.doc php.qa |
| Request: | Send a blank email to php-dev+get-78930@lists.php.net to get a copy of this message | ||
On Sat, 2002-02-02 at 18:25, Mika Toewe wrote:
> Hi
>
> Is there anything that can manipulate a variable bit by bit? If have a
> variable $x that has to switch between two values. It doesn't matter if
> it is true or false, 0 and 255 or whatever. Normally the easiest way
> would be to use xor to have the variable switch between both states but
> I couldn't find anything like that in the reference.
>
> Does PHP support such kind of bit manipulation? Or does anybody know
> another way to have the variable switch on an easy way? I know that it
> is possible with several if...thens but I'm looking for an easier and
> faster way. Thanks for your answers and help.
>
> Mika
First off, please don't crosspost to all these lists. The list for
general questions in PHP is php-general@lists.php.net; the lists
this question was posted to are for the PHP quality assurance team,
the documentation team, and the development team, respectively.
You can find a list of the available mailing lists, their
purposes, and an easy-to-use subscription form at:
http://www.php.net/mailing-lists.php
Second, the knowledge you seek is in the manual, under 'Language
Reference|Operators|Bitwise operators':
http://www.php.net/manual/en/language.operators.bitwise.php
Hope this helps,
Torben
--
Torben Wilson <torben@php.net>
http://www.thebuttlesschaps.com
http://www.hybrid17.com
http://www.inflatableeye.com
+1.604.709.0506