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

From: Date: Fri, 30 Apr 2004 16:23:51 +0000
Subject: Re: Control structure - easier way than repeating conditions in IF?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-185056@lists.php.net to get a copy of this message
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:
*********************************************** This Email Has Been Virus Swept *********************************************** Hello! Can anyone tell me if there is an easier/shorthand for:
if  (    ($x == $a) || ($x == $b) || ($x == $c) || ($x == $d) ....... ) {;}
I understand the logic of why the following does not work: if ($x == ($a || $b || $c || $d)) {;} Thanks!
-- ---------------------- www.curvedvision.com ---------------------- This communication is confidential to the intended recipient(s). If you are not that person you are not permitted to make use of the information and you are requested to notify the sender immediately of its receipt then destroy the copy in your possession. Any views or opinions expressed are those of the originator and may not represent those of Advanced System Architectures Ltd. *** This Email Has Been Virus Checked ***

« previous php.general (#185056) next »