|
Posted by Ciaran on 05/19/07 13:05
On May 19, 1:52 pm, gosha bine <stereof...@gmail.com> wrote:
> Ciaran wrote:
> > Is there a more efficient way to write this:
> > if($var=1 || $var=4 || $var=27 || $var=28 || $var=30 || $var=37 ||
> > $var=38){echo "true";}
>
> > Cheers,
> > Ciarán
>
> ='s should be == I guess
>
> if(in_array($var, array(1, 4 etc)))
>
> is perhaps shorter, but not "more efficient", so the answer is "no".
>
> --
> gosha bine
>
> extended php parser ~http://code.google.com/p/pihipi
> blok ~http://www.tagarga.com/blok
Oops yes = should be ==
Ok I thought there might be a IN(1,4,etc) clause in PHP like other
languages.
Thanks for the reply,
Ciarán
Navigation:
[Reply to this message]
|