title: php: check if path exists?
body: <p>I am setting a path variable with a query-string.</p>
  <p>What is the easiest way to check if the path (always a directory) exists or not.</p>
  <pre><code>    if(isset($_GET['p'])) {
      define(PATH, $_GET['p']);
  </code></pre>
  <p>So now I have like mydomain.com?p=files/folder/sub and everything works fine, i'm reading the contents of the folder. However, I can pass along ?p=shit/whatever and i don't get a 404 or anything like that. the system reads a folder which does not even exist.</p>
  <p>I don't even need a 404, but just want to print('does not exist!') or anything similar.</p>
  <p>What is the best method to do that?</p>