Re: If statement w/ multiple conditions

From: Date: Tue, 26 Nov 2002 13:05:27 +0000
Subject: Re: If statement w/ multiple conditions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-126078@lists.php.net to get a copy of this message
At 13:50 26.11.2002, ed@home.homes2see.com said: --------------------[snip]-------------------- > I'll be trying to use a routine that checks 4 seperate variables for >content and need to know the easiest method to do so. The function works >on 2 conditions; either all the variables are empty and I do something or >I do something else. > >$lineone >$linetwo >$linethree >$linefour > > Would you use > >if ($lineone && $linetwo && $linethree && $linefour = "") --------------------[snip]-------------------- Your expression yields true if 1-3 are not-empty AND four is an empty string. Not sure if that's what you want. All empty: !($lineone || $linetwo || $linethree || $linefour) --or-- !$lineone && !$linetwo && !$linethree && !$linefour All set: $lineone && $linetwo && $linethree && $linefour -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#126078) next »