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
* 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:
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
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"
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
[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
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
7 matches
Mail list logo