Re: RE: **[SPAM]** [PHP] Correct context
| From: | Mattias Thorslund | Date: | Mon, 20 Sep 2004 17:53:06 +0000 |
| Subject: | Re: RE: **[SPAM]** [PHP] Correct context | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-197319@lists.php.net to get a copy of this message | ||
Jay Blanchard wrote:
[snip] Before I go screwing this code up I thought I would ask for the formatting. How would you write the following in PHP? if $entry not equal to "Copy Change" OR "Banner Change" OR "Price Change" AND $row['photo_check'] not equal to "" [/snip] There are several ways .... here is one.... if(("" != $row['photo_check']) && (("Copy Change" != $entry) || ("Banner Change" != $entry) || ("Price Change" != $entry))) Note the parentheses to define preference order.How about : if("" != $row['photo_check'])){ switch($entry){ case "Copy Change": case "Banner Change": case "Price Change": break; default: //put your code here } } Longer but seems more readable to me. Disclaimer: I have probably left a silly typo somewhere. /Mattias -- http://www.thorslund.us