Image

Imageswitchstatement wrote in Imagephp

checking a variable against multiple values

aside from dumping the values into an array and then using in_array(), is it possible to write a comparison statement that checks against multiple values? i often find myself doing something like


if ($x == 1 || $x == 2 || $x == 3) {
do_some_junk();
}


which seems kind of messy. it'd be nice if there was something like


if ($x in(1,2,3)) {
do_some_junk();
}


i've tried experimenting but haven't come up with anything.