Re: simple: if ( '$foo = more that one expression ) { }

From: Date: Wed, 23 Aug 2000 21:46:43 +0000
Subject: Re: simple: if ( '$foo = more that one expression ) { }
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-2083@lists.php.net to get a copy of this message
AJ> I need to know if there is a way to compare a variable against AJ> more than one condition... AJ> if ( $foo = "north" OR "south" OR "west" OR "mount" ) AJ> { } John: You can do this: if (ereg(" $foo "," north south west mount ")) { } The spaces before and after $foo are necessary to avoid matching "nor" or "rth" or some other word that is a part of the ones you are looking for, ereg will return TRUE if the first string was found inside the second one, false otherwise. Saludos, Pablo Vera

« previous php.windows (#2083) next »