title: PHP - if == not working for 0 or ""
body: <p>I am checking the validation of the request with an if query,</p>
  
  <pre><code>if ($request_userid == $userid) {
  ...
  }
  </code></pre>
  
  <p>Thats working as expected. But further testing has shown, that if <code>$request_userid</code> or <code>$userid</code> is 0 or "", then the condition is true and the script runs the if query but it shouldn't.</p>
  
  <p>I am currently solving it with:</p>
  
  <pre><code>if ($userid == "" ) {
  exit ("exit");
  }
  </code></pre>
  
  <p>But I don't think that this is the right way?</p>
  
  <p>Can you explain why it doesn’t work with the if query and what would be the correct way to check it?</p>