Re: If statement w/ multiple conditions
| From: | Chris Shiflett | Date: | Tue, 26 Nov 2002 17:15:33 +0000 |
| Subject: | Re: If statement w/ multiple conditions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126132@lists.php.net to get a copy of this message | ||
--- Ernest E Vogelsinger <ernest@vogelsinger.at> wrote:
> >> >if ($lineone && $linetwo && $linethree && $linefour =
> >> >"")
> >>
> >> Your expression yields true if 1-3 are not-empty AND four is an
> >> empty string.
> >
> > Actually, this expression yields true when $lineone, $linetwo,
and
> > $linethree are all true. The variable $linefour is just being set
> > tothe empty string.
>
> You're so right - I think I need new glasses...
>
> Thanks for setting this straight :)
No problem, except I was wrong, too. :-) Because $linefour is being
set to the empty string, it will evaluate to false, causing the
entire statement to always evaluate to false.
Chris