Re: [PHP] Testing if any of the items are false

2003-02-10 Thread Chris Shiflett
--- [EMAIL PROTECTED] wrote:
> How can I do this to determine if one of the items is
> false if none are then I what it to print the first
> echo of there is one that is false then print the
> second echo

Sorry, that makes no sense to me.

> $test1= "YES";
> $test2= "YES";
> $test3= "YES";
> $test4= "YES";
> $ftest1= "YES";
> $ftest2= "NO";
> $ftest3= "YES";
> $ftest4= "YES";
> 
> if
> ($test1==$ftest1)or($test2==$ftest2)or($test3==$ftest3)
> or($test4==$ftest4){
> echo "all of the items are true";
>  }else{
>   echo "one of the items is false";
>  }

That code makes less sense. Are you wanting to see if each
of your $test variables match their corresponding $ftest
variable?

Your current statement is true when any of the $test
variables match their corresponding $ftest variable. Try
using "and" instead of "or" if you want to require them all
to be true. Just read it aloud, and it should make sense.

if ($flavor == 'vanilla' || $flavor == 'chocolate')
{
   eat('ice_cream');
}

In this example, you would eat the ice cream if it was
vanilla *or* chocolate.

Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Testing if any of the items are false

2003-02-10 Thread rdkurth


How can I do this to determine if one of the items is false if none are
then I what it to print the first echo of there is one that is false
then print the second echo
$test1= "YES";
$test2= "YES";
$test3= "YES";
$test4= "YES";
$ftest1= "YES";
$ftest2= "NO";
$ftest3= "YES";
$ftest4= "YES";

if ($test1==$ftest1)or($test2==$ftest2)or($test3==$ftest3)
or($test4==$ftest4){
echo "all of the items are true";
 }else{
  echo "one of the items is false";
 }

-- 
Best regards,
 rdkurth  mailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php