On Friday 20 December 2002 08:19, Beauford.2002 wrote:
> Hi,
>
> This should be as simple as breathing, but not today. I have two variables
> $a and $b which I need to compare in a switch statement in several
> different ways, but no matter what I do it's wrong.
>
> This is what I have tried, can someone tell me how it should be.
>
> TIA
>
> switch (true):
>
>     case ($a == $b):             This one seems simple enough.
>             do sum stuff;
>             break;
>
>     case ($a && $b == 124):   This appears not to work.
>             do sum stuff;
>             break;
>
>     case ($a == 124 && $b == 755):  If $a is equal to 124 and $b is equal
> to 755 then it should be true..doesn't work.
>             do sum stuff;
>             break;
>
>     case ($a == 124 && $b != 124):   Nope, this doesn't appear to work
> either.
>             do sum stuff;
>             break;
>
> endswitch;

AFAICS all of them should work. The 2nd case may not work the way you 
intended. It is testing for, if $a is TRUE, AND if $b equals 124.

Where are you getting $a and $b from?

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

/*
You'll feel much better once you've given up hope.
*/


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

Reply via email to