[PHP] One variable not equal to 2 values.

2003-09-25 Thread Ed Curtis

 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, visit: http://www.php.net/unsub.php



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 happens if the first
evaluates true? false?
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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

2003-09-25 Thread Cesar Cordovez
corection to last postBut 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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


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:
 corection to last postBut 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
 
  
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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:
// do stuff
break;
}



Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



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 ($thisvar) {
   case 'thisvalue':
   case 'thatvalue':
 break;
   default:
 // do stuff
 break;
 }

*grin* here's another:

if( $thisvar == 'this value'
? false
: ($thisvar == 'that value'
? false
: true) )
{
// do stuff.
}

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php