title: Why can't I use an "if" statement to return true/false in a PHP function?
body: <p>Why does it not work to use an <code>if</code> statement to determine if a function should return true or false? True works, but false doesn't.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>function test($var){
      if($var == "string"){
          return true;
      }else{
          return false;
      }
  }
  </code></pre>
  
  <p>Doing: 
  <code>echo test("string");</code> returns <code>true</code> as it should, but using <code>echo test("hello");</code> should return <code>false</code>, but returns nothing, why?</p>
  
  <p>What should be used instead for returning true/false with criteria?</p>