|
Posted by purcaholic on 05/19/07 17:44
On 19 Mai, 14:47, Ciaran <cronok...@hotmail.com> 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
Other way to simplify it is to compose a string using a delemiter
character and to search inside composed string, like:
if (strstr("|".$var."|", "|1|2|27|28|30|37|38|")) {
echo "true";
}
purcaholic
Navigation:
[Reply to this message]
|