Re: find string

From: Date: Mon, 11 Aug 2003 00:19:45 +0000
Subject: Re: find string
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-159081@lists.php.net to get a copy of this message
On Mon, 11 Aug 2003 10:00:57 +1000 (EST) <daniel@electroteque.org> wrote: > what exactly is action ? > > i usually use a action setup like follows > > ?action=update > > switch ($_GET['action']) { > case 'update': > //do stuff here > break; > case 'insert': > //do stuff here > break; > > } > > very clean Action is exactly what you imagine and at some point in the scrip I use what you suggest, why I didn't do it here is because I didn't have enough coffee today ;-). Nevertheless the previously suggested solution using in_array() seems cleaner in this case. > > > 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

« previous php.general (#159081) next »