Re: [PHP] Control structure - easier way than repeating conditions in IF?

2004-04-30 Thread Neil Freeman
Why not just use a switch?... switch ($x) { case $a: case $b: case $c: case $d: //do whatever you need break; default: //catch any other values here break; } Neil BOOT wrote: **

RE: [PHP] Control structure - easier way than repeating conditions in IF?

2004-04-30 Thread Gryffyn, Trevor
You could do something like this: $valuesarr = array($a,$b,$c,$d); If (in_array($x,$valuesarr)) { # do something } Or I guess even: If (in_array($x,array($a,$b,$c,$d))) { # do something } I don't know if your method or this method have better performance but it's a little eas