question about using "if else" and multiple criteria
| From: | Sabrina Goodpaster | Date: | Thu, 07 Dec 2000 22:11:23 +0000 |
| Subject: | question about using "if else" and multiple criteria | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-29225@lists.php.net to get a copy of this message | ||
I am trying to use the following:
if ($num_rows == "0") {
echo "....My Output....";
} elseif (ereg(".", $last_name) < 1) | (ereg(".", $email) < 6) {
echo "....Different Output....";
} else {
echo "...Another kind of Output...";
}
My problem is the second ereg function in the "elseif" statement. If I
remove the OR operator and the second ereg statement, it works just great.
I tried putting parenthesis around it :
} elseif ((ereg(".", $last_name) < 1) | (ereg(".", $email) < 6))
And it does appear to parse the statement after adding the paranthesis, but
it doesn't work properly. Even if $last_name and $email are greater than 1
and 6, it acts as though they are not, and prints the output of the elseif
statement, instead of the else statement that it should be going to.
Any suggestions? I need to link together about 5 or 6 of these conditional
OR statements on that elseif line.
Thanks,
Sabrina