title: How to check if file exists in in set of paths?
body: <p>How to check if file is in in the selected path?</p>
  
  <pre><code>$_SERVER['DOCUMENT_ROOT'] === '/home/user/soloj';
  </code></pre>
  
  <p>Several paths:</p>
  
  <pre><code>/home/user/soloj/admin/user/file.php // false
  /home/user/soloj/client/file.php // false
  /home/user/soloj/public/file.php // true
  /home/user/soloj/temp/file.php // true
  /home/user/soloj/temp/folder/folder/file.php // true - all after temp is true
  /home/user/soloj/zero/file.php // false
  </code></pre>
  
  <p>So if file is in <code>/home/user/soloj/public/</code> or <code>/home/user/soloj/temp/*</code> then my function should return true;</p>
  
  <pre><code>$paths = array(
      '/home/user/soloj/public/',
      '/home/user/soloj/temp'
  );
  
  function check($paths, $path)
  {
     if ($path IN $paths) {
         return true;
     } else {
         return false;
     }
  }
  
  check($paths, 'public/file.php'); // true
  check($paths, 'zero/file.php'); // false
  check($paths, 'temp/aaa/file.php'); // true
  check($paths, 'public/../zero/file.php'); // false
  </code></pre>