On Thu, 2011-04-28 at 22:12 -0400, Jim Giner wrote:
> Obviously you have designed a search/decision mechanism that suits your
> needs. The OP did not present a problem of such magnitude. He only asked
> how to handle a decision process the most efficient way - with no mention of
> higher goals such as yours.
>
> didn't mean to offend anyone who has made a powerful use of the array
> constuct.
>
> "Geoff Lane" <[email protected]> wrote in message
> news:[email protected]...
> > On Thursday, April 28, 2011, Jim Giner wrote:
>
>
>
I see no problem using in_array() for situations like this, and they can
be used in conjunction with a switch if you want as well:
switch(true)
{
case in_array($needle, array('foo','bar','wtf')):
{
// do something
break;
}
case ($needle == 88):
{
// something else
break;
}
}
And it's still quite readable as long as you get your indentation right.
--
Thanks,
Ash
http://www.ashleysheridan.co.uk