RE: [PHP] Why is this happening
| From: | Boget, Chris | Date: | Wed, 18 Apr 2001 12:59:55 +0000 |
| Subject: | RE: [PHP] Why is this happening | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-49202@lists.php.net to get a copy of this message | ||
> >> >Ok, I found out what the problem was. I'm still curious
> >> >why the problem is occuring.
> >> >> if( $tmpArray[errorNumber] & $typesToDisplay ) {
> >> you're using the bitwise & when you want the logical &&
> >No, I actually wanted to use the bitwise &. I wanted to see
> >if the "errorNumber" was in $typesToDisplay.
> without seeing the code I would guess you should be using in_array().
Except that $typesToDisplay is not an array. It is made up of
something like this:
$typesToDisplay = ( 1 | 2 | 4 | 8 | 32 | 64 );
And to see if the errorNumber is part of the above, you bitwise
"&" it.
Chris