Re: question about using "if else" and multiple criteria

From: Date: Thu, 07 Dec 2000 22:17:54 +0000
Subject: Re: question about using "if else" and multiple criteria
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-29226@lists.php.net to get a copy of this message
For "or"ing things in an "if", you need to use either "||"(double pipe) or the word "or". HTH. -- Hardy Merrill Mission Critical Linux, Inc. http://www.missioncriticallinux.com Sabrina Goodpaster [sabrina@blueriver.net] wrote: > 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 > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#29226) next »