Testing if either of two condtions are true

I'm trying to test if either of two variables are true using the code below, but I the code always returns the true conditions even when the variable is blank. Have I done this correctly or is it possible the variables are always true?

Thanks in advance for your help.

<?php 
if (($gogo_team_member_twitter !== true) or ($gogo_team_member_facebook !== true)) {  
echo('class="amb-with-socal"');
}
else echo('class="amb-without-socal"');
?>

Answers


If you need "Testing if either of two condtions are true" then your condition should look like:

if ($gogo_team_member_twitter === true || $gogo_team_member_facebook === true)

or just

if ($gogo_team_member_twitter || $gogo_team_member_facebook)

if you don't need strict comparison


You have the right idea, but you're checking that the variables are not true. Surely you want to check if either is true?

Also, try to use || and && rather than or and and, as they have a higher precedence.


Need Your Help

Unsatisfied Link Error

java jni

Why am i getting Unsatisfied Link Error?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.