Re: [PHP] Bitwise operators and check if an bit is NOT within the flag.

2006-07-07 Thread Richard Lynch
On Tue, July 4, 2006 7:35 am, Mathijs wrote: //Do if VALIDATE_CHECK1 is set BUT NOT when VALIDATE_CHECK3 is set. if ($flag2 self::VALIDATE_CHECK1 $flag2 ~self::VALIDATE_CHECK3) Did you check operator precedence for versus ? Perhaps you just need parentheses... I'm also not at all sure the

Re: [PHP] Bitwise operators and check if an bit is NOT within the flag.

2006-07-04 Thread Jochem Maas
Mathijs wrote: Hello there. I am working with some bitwise Operators for validating some variables. Now i need to know if an certain bit is NOT set and an other bit IS set. Example. ?php const VALIDATE_CHECK1 = 1; const VALIDATE_CHECK2 = 2; const VALIDATE_CHECK3 = 4; const

Re: [PHP] Bitwise operators and check if an bit is NOT within theflag.

2006-07-04 Thread Mathijs
Jochem Maas wrote: Mathijs wrote: Hello there. I am working with some bitwise Operators for validating some variables. Now i need to know if an certain bit is NOT set and an other bit IS set. Example. ?php const VALIDATE_CHECK1 = 1; const VALIDATE_CHECK2 = 2; const VALIDATE_CHECK3 = 4;

Re: [PHP] Bitwise operators and check if an bit is NOT within theflag.

2006-07-04 Thread Jochem Maas
Mathijs wrote: Jochem Maas wrote: Mathijs wrote: ... Thank you very much. This seems to work :). cool. heres's a couple of funcs that might help you to understand bitwise operations better: ?php /* whether there is only 1 single bit set or not */ function single_bit_set(/*int*/ $i)

Re: [PHP] Bitwise operators and check if an bit is NOT within theflag.

2006-07-04 Thread Mathijs
Jochem Maas wrote: Mathijs wrote: Jochem Maas wrote: Mathijs wrote: ... Thank you very much. This seems to work :). cool. heres's a couple of funcs that might help you to understand bitwise operations better: ?php /* whether there is only 1 single bit set or not */ function

Re: [PHP] Bitwise operators and check if an bit is NOT within theflag.

2006-07-04 Thread Mathijs
Jochem Maas wrote: Mathijs wrote: Jochem Maas wrote: Mathijs wrote: ... Thank you very much. This seems to work :). cool. heres's a couple of funcs that might help you to understand bitwise operations better: ?php /* whether there is only 1 single bit set or not */ function

Re: [PHP] Bitwise operators and check if an bit is NOT within theflag.

2006-07-04 Thread Mathijs
Jochem Maas wrote: Mathijs wrote: Jochem Maas wrote: Mathijs wrote: ... Thank you very much. This seems to work :). cool. heres's a couple of funcs that might help you to understand bitwise operations better: ?php /* whether there is only 1 single bit set or not */ function

Re: [PHP] Bitwise operators and check if an bit is NOT within theflag.

2006-07-04 Thread Mathijs
Jochem Maas wrote: Mathijs wrote: Jochem Maas wrote: Mathijs wrote: ... Thank you very much. This seems to work :). cool. heres's a couple of funcs that might help you to understand bitwise operations better: ?php /* whether there is only 1 single bit set or not */ function

RE: [PHP] Bitwise operators

2005-09-26 Thread Chris W. Parker
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] on Monday, September 26, 2005 9:18 AM said: So i ask what this output? $a = 4; $b = 3; echo $a $b; echo $a $b; You just spent 3-5 minutes writing an email and now almost 10 minutes waiting for a reply to something that would have taken

Re: [PHP] Bitwise operators

2005-09-26 Thread Robin Vickery
On 9/26/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: From php manual: $a $b Shift leftShift the bits of $a $b steps to the left (each step means multiply by two) $a $b Shift rightShift the bits of $a $b steps to the right (each step means divide by two) So i ask what this output? $a

Re: [PHP] Bitwise operators

2005-09-26 Thread cron
[EMAIL PROTECTED] To: php-general@lists.php.net Sent: Monday, September 26, 2005 1:28 PM Subject: RE: [PHP] Bitwise operators [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] on Monday, September 26, 2005 9:18 AM said: So i ask what this output? $a = 4; $b = 3; echo $a $b; echo $a $b

Re: [PHP] Bitwise operators

2005-09-26 Thread Chris Boget
I tested; I don't want to waste peoples time. Rewriting the question: this outputs: c = 32 d = 0 The question is why? First row is the bit's number and the second row is the bit's value: #8 | #7 | #6 | #5 | #4 | #3 | #2 | #1 --- 128 | 64 | 32 | 16 | 8 |

Re: [PHP] Bitwise operators

2005-09-26 Thread cron
The second value is the number of spaces to shift, dint realize that. Thanks for your time Chris. Angelo - Original Message - From: Chris Boget [EMAIL PROTECTED] To: [EMAIL PROTECTED]; php-general@lists.php.net Sent: Monday, September 26, 2005 2:02 PM Subject: Re: [PHP] Bitwise