On Thursday 21 November 2002 01:34, Ryan Gallagher wrote:

> Try:
>
> if( ( $_GET['sc'] != 2 ) OR ( $_GET['sc'] != 8 ) ){
>   /*
>    * Do Foo provided sc is anything but a 2 or 8
>    */
>   do foo;
> }
>
> Assuming of course that you meant to exclude cases of 2 or 8.  It's a bit
> hard to tell what your intended event for 8 is.

The above would not have the intended effect. My boolean maths is extremely 
rusty but I think it is equivalent to saying:

  if (!($_GET['sc'] == 2  AND  $_GET['sc'] == 8))

Which means your code above is *always* TRUE, so do foo is always executed!

In any case you can easily test it by mentally plugging in values 1 to 8 for 
$_GET['sc'] and evaluating it for yourself.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
History repeats itself.  That's one thing wrong with history.
*/


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

Reply via email to