On Sun, 10 Aug 2003 19:27:12 -0400 "Carl Furst" <[EMAIL PROTECTED]> wrote:
> Isn't there an in_array function you can use? > > If (in_array($action, array(a1,a2,a3,a4)) { > // do something > } > else { > // do something else > } > > > Carl. Thanks Carl, if there is no string function for the job I'll have to use the array. > > -----Original Message----- > From: andu [mailto:[EMAIL PROTECTED] > Sent: Sunday, August 10, 2003 7:15 PM > To: [EMAIL PROTECTED] > Subject: [PHP] find string > > Here's the problem I have: > I have $action which can be anyone of a1, a2, a3, a4. > I tried > > if ($action!='a1' || $action!='a3') //tried == also > { > //do stuff > } > else > { > //do other stuff > } > > Problem is that if() only seems to take one option so my construct > above doesn't work. > What function can I use to do something like: > if ($action is among the items of 'a2,a4') kind of construct? > I tried strpos('a1a2a3',$action) but with the same results. > TIA > > -- > Regards, Andu Novac > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- Regards, Andu Novac -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php