Help with PHP condition

Hi,

I have the attached code condition but it is not working properly:

I want to do the action if ANY of both conditions are true:

if ( is_user_logged_in() OR $_SESSION['count'] <= 3 )

What is wrong here? why not working fine ?

Thanks.

<?php if ( is_user_logged_in() OR $_SESSION['count'] <= 3 )  {
echo "<h1 ><a class='ta'  title='Permalink to $ltitle' href='$url' target='_blank'>$ltitle</a></h1>"; 
}
else {
echo "<h1 ><a class='ta'  title='Permalink to $ltitle' href='/registration'>$ltitle</a></h1>";  
}
?>

Open in new window

FernanditosAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
PranjalShahConnect With a Mentor Commented:
I am not sure if this would help but try changing OR to ||


if ( is_user_logged_in() || $_SESSION['count'] <= 3 )
0
 
Dave BaldwinFixer of ProblemsCommented:
I don't see an obvious problem.  What error message or result are you getting?
0
 
Dave BaldwinFixer of ProblemsCommented:
On http://www.php.net/manual/en/language.operators.logical.php , all the operators are shown as lower case.  ??
0
 
InsoftserviceCommented:
try this one, will work

<?php if ( (is_user_logged_in()) || ( $_SESSION['count'] <= 3) )  {
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.