Re: [PHP] One variable not equal to 2 values.

2003-09-25 Thread Robert Cummings
On Thu, 2003-09-25 at 19:49, Curt Zirzow wrote: > * Thus wrote Ed Curtis ([EMAIL PROTECTED]): > > > > How would I write this statement: > > > > if $thisvar is not equal to this value or that value. { do stuff } > > > > Ok. I have to throw this in for historical purposes :) > > switch ($thisv

Re: [PHP] One variable not equal to 2 values.

2003-09-25 Thread Curt Zirzow
* Thus wrote Ed Curtis ([EMAIL PROTECTED]): > > How would I write this statement: > > if $thisvar is not equal to this value or that value. { do stuff } > Ok. I have to throw this in for historical purposes :) switch ($thisvar) { case 'thisvalue': case 'thatvalue': break; default:

Re: [PHP] One variable not equal to 2 values.

2003-09-25 Thread Robert Cummings
Another version that is logically correct unlike some of the others I saw :) if( !($thisvar == "this value" or $thisvar == "that value") ) { // stuff to do. } Cheers, Rob. On Thu, 2003-09-25 at 14:59, Cesar Cordovez wrote: > But then... you have to use "and" not "or" > like: > > if (($this

Re: [PHP] One variable not equal to 2 values.

2003-09-25 Thread Cesar Cordovez
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: But then... you have to use "and" not "or"

Re: [PHP] One variable not equal to 2 values.

2003-09-25 Thread Cesar Cordovez
But then... you have to use "and" not "or" like: 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 statemen

RE: [PHP] One variable not equal to 2 values.

2003-09-25 Thread Jay Blanchard
[snip] How would I write this statement: if $thisvar is not equal to this value or that value. { do stuff } [/snip] You already wrote it. Now if you want the PHP way RTFM about conditional statements. if($thisvar != thisval || $thisvar != thatval){ there be dragons here, because what ha

Re: [PHP] One variable not equal to 2 values.

2003-09-25 Thread Cesar Cordovez
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visi