Re: One variable not equal to 2 values.

From: Date: Thu, 25 Sep 2003 19:03:16 +0000
Subject: Re: One variable not equal to 2 values.
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-163972@lists.php.net to get a copy of this message
Other way to do it is: $posible_values = array("this value", "that value", "other value"); if (in_array($thisvalue, $posible_values)) { // $thisvalue is in $posible_values } else { // $thisvalue is NOT in $posible_values } Cesar I wrote:
<corection to last post>But then... you have to use "and" not "or" like:</corection to last post> if (($thisvar != "this value") and ($thisvar != "thatvalue")) {
     // do stuff
} Cesar Cordovez wrote:
if (($thisvar != "this value") or ($thisvar != "thatvalue")) {
    // do stuff
} cesar =) Ed Curtis wrote:
How would I write this statement: if $thisvar is not equal to this value or that value. { do stuff } Thanks, Ed


« previous php.general (#163972) next »