RE: [PHP] What's wrong with this IF statement?
| From: | Michael Sims | Date: | Thu, 22 Apr 2004 20:47:01 +0000 |
| Subject: | RE: [PHP] What's wrong with this IF statement? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-184296@lists.php.net to get a copy of this message | ||
John W. Holmes wrote:
> You want && instead of ||
>
> if ($cat_id != "53" && $cat_id != "54" && $cat_id !=
> "55" && $cat_id
> != "117" && $cat_id != "118" && $cat_id != "74")
For stuff like this I've always found the following slightly easier on the
eyes:
if (!in_array($cat_id, array('53', '54', '55', '117',
'118', '74')))
YMMV...