--- Ernest E Vogelsinger <[EMAIL PROTECTED]> wrote:
> At 13:50 26.11.2002, [EMAIL PROTECTED] said:
> >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 to
the empty string.
Don't confuse boolean tests with tests for whether a string is empty.
Yes, an empty variable will evaluate as false, but so will a variable
containing 0 or set to false.
> All empty:
> !($lineone || $linetwo || $linethree || $linefour)
> --or--
> !$lineone && !$linetwo && !$linethree && !$linefour
> All set:
> $lineone && $linetwo && $linethree && $linefour
Same problem here. Try these conditionals with the following values:
$lineone = 0;
$linetwo = 0;
$linethree = 0;
$linefour = 0;
Something like this will probably work:
$all = $lineone . $linetwo . $linethree . $linefour;
if (empty($all))
{
echo "All lines are empty";
}
else
{
echo "All lines are not empty";
}
Chris
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php