With a logical OR statement, many languages will evaluate the first 
statement, and if the first condition is true, then it will not evaluate 
the second condition, because TRUE OR (anything) is TRUE.  This saves the 
program from executing any more code than it has to.  If the first 
condition is FALSE, then the second condition will be checked.

If you are wanting both $name and $text to be true in order for the first 
block of code to be executed, then you will want to use an AND (&&) statement.

I hope that answers your question.


At 02:04 PM 1/28/2002 -0600, jv wrote:
>It seems that only the first condition is being evaluated.
>I know that if  both of the following conditions are false then the second
>set of statements should get read, and that's what happens, but when I set
>$name to true and $text to false (true||false) then the first set gets read.
>Shouldn't both conditions be true in order for the first set of statements
>be read? Why would the first set of statements get read when the conditions
>are (true||false)?
>Thanks in advance for your help.
>if ($name || $text)
>     {
>   $text = stripslashes("$text");
>   print "Hello $name\n<br>";
>   print "You said:\n<br> $text\n";
>         }else{
>   print "Sorry, but you seem to have left one or more entries blank.<br>\n";
>   print "Please return to <a href=\"/prac/form.html\">form</a>\n";
>   print " and complete the input<br>\n";

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to