title: PHP != and == operators
body: <p>This has boggled me for a while. I am running through a directory and echo'ing out its contents, and I want to exclude the ".." and "." files.</p>
  
  <p>Now, this code works:</p>
  
  <pre><code>if ($files = scandir("temp/"))
  {
      foreach ($files as $file)
      {
          if ($file == ".." OR $file == ".")
          {
          }
          else {
              echo $file;
              echo "&lt;br&gt;";
          }
      }
  }
  </code></pre>
  
  <p>But this doesn't...</p>
  
  <pre><code>if ($files = scandir("temp/"))
  {
      foreach ($files as $file)
      {
          if ($file != ".." OR $file != ".")
          {
              echo $file;
              echo "&lt;br&gt;";
          }
      }
  }
  </code></pre>
  
  <p>For obvious reasons the second lump of code is more what I want, because I really hate having the true statement do nothing.</p>