title: php header location not redirecting page
body: <p>I have following code in the start of my php file but somehow it doesnt redirect to login page, however if I separate if condition into sub if condition then redirection works
  <strong>Below code doesnt work</strong></p>
  
  <pre><code>if (!isset($_SESSION['emailid'], $_SESSION['roleid']) &amp;&amp; $_SESSION['roleid'] != 1) {
    header('location:login.php?lmsg=true');
    exit;
  }
  ///This doesnt work
  </code></pre>
  
  <p><strong>Below code work</strong></p>
  
  <pre><code>if (!isset($_SESSION['emailid'], $_SESSION['roleid'])) {
    header('location:login.php?lmsg=true');
    exit();
  }
  if ($_SESSION['roleid'] != 1) {
    header('location:login.php?lmsg=true');
    exit();
  }
  ///this works
  </code></pre>
  
  <p>can someone help?</p>