Re: if question

From: Date: Tue, 17 Dec 2002 13:31:48 +0000
Subject: Re: if question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-128553@lists.php.net to get a copy of this message
DUH ! Thanks all ! Obviously a slight case of brain death there ! > Hi John, > > > Can anyone tell me why this doesn't seem to work ?? > > It probably is working, but it's obviously not doing what you want :-) > > > if (($stelle_who != '1') OR ($stelle_who != '2') OR > > ($stelle_who != '3') OR ($stelle_who != '5') ) { > > This will always evaluate to true: > > if $stelle_who is "1", it doesn't equal 2 or 3 or 5 > if $stelle_who is "4", it doesn't equal 1 or 2 or 3 or 5 > > > and what can i use as an alternative syntex ?? > > Depends what you're trying to do... most likely switch your ORs to ANDs, > though (that'll evaluate to true if $stelle_who is neither 1 nor 2 nor 3 nor > 5, and to false if it is any of these). > > Cheers > Jon > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#128553) next »