Re: Short writage of clauses

From: Date: Mon, 12 Jun 2006 10:26:41 +0000
Subject: Re: Short writage of clauses
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-237799@lists.php.net to get a copy of this message
Stut wrote: > Jochem Maas wrote: >> Stut wrote: >> >>> But it begs the question why you would want to do this? >>> >> >> it's a handy way to white list data. e.g. >> >> if (in_array($_GET['yourarg'], $allowedValsForYourArg)) echo "nice arg >> dude"; >> >> (btw: no need to beg ;-) >> > > I agree that the in_array function is useful, but the OP was asking for > a way to shorten (a == 1 or a == 2). Maybe the question was poorly > stated and meant to ask how to compare a variable to a larger number of > values but that's not what I got from it. I read it as an 'I want to > save my fingers a bit of typing' and wondered if I was missing the point. I got that too - I mostly think the 'I want to save my fingers a bit of typing' idea is bogus - which is why I went off at a bit of a tangent. > > I beg your pardon. pardon is in the mail :-) > > -Stut >

« previous php.general (#237799) next »