RE: [PHP] How do I convert an array into a mask?
| From: | John W. Holmes | Date: | Wed, 06 Nov 2002 13:09:43 +0000 |
| Subject: | RE: [PHP] How do I convert an array into a mask? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122983@lists.php.net to get a copy of this message | ||
> Oooh! I think you're on to something there. Nice!
>
> Hey, what's the "@" symbol for? I see in the manual the "&" is a
> reference (like a pointer in C I assume), but I can't find the "@"
> explained.
>
> > if(@$purchitem[$y] == $x)
It'll suppress warnings and errors. If the $purchitem does not have a
key 4 or 5, like in your example, then you'll get a warning for
undefined offset, depending on your error reporting level. This just
suppresses that.
If you do it this way, you may want to sort $purchitem if you can't
guarantee it's going to be in ascending order. Or you can use in_array()
and not care about the order.
---John Holmes...