Where can I read more about this?  I'm not sure that I understand why 4
& 4 == 4.


-----Original Message-----
From: Greg Beaver [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 07, 2003 11:04 PM
To: [EMAIL PROTECTED]; James Taylor
Subject: [PHP] Re: Difference between & &&


Hi James,

& is a bit-wise AND.  && is a logical AND.  The bitwise AND will return 
a number, the logical AND will return true or false boolean values. 
It's a subtle distinction, but important.  4 & 4 == 4  4 && 4 == true ==
1

Regards,
Greg
--
phpDocumentor
http://www.phpdoc.org

James Taylor wrote:
> Ok, this may have already been posted to the list already, but the 
> archives don't seem to like the & and && characters.
> 
> I'm running into some code that looks like this:
> 
> <snip>
> Define('INPUT', 2);
> <snip>
> if($search->level & INPUT) $tmp.= $search->input();
> 
> 
> Ok, what's the & mean?
> 
> As far as I could tell from the very little documentation I was able 
> to scrape up on google, & is a bit-by-bit operator.  Thus, if either 
> INPUT or $search->level, we get TRUE... If that's the case, what's the

> point of using it instead of || ?
> 
> Or, do I just totally not understand the point of this.  Thanks
> 
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to