title: Is There A Way To glob() Only Files?
body: <p>I know that <a href="http://php.net/manual/en/function.glob.php" rel="noreferrer"><code>glob</code></a> can look for all files or only all directories inside a folder :</p>
  
  <pre><code>echo "All files:\n";
  $all = glob("/*");
  var_dump($all);
  
  echo "Only directories\n";
  $dirs = glob("/*", GLOB_ONLYDIR);
  var_dump($dirs);
  </code></pre>
  
  <p>But I didn't found something to find only files in a single line efficiently.</p>
  
  <pre><code>$files = array_diff(glob("/*"), glob("/*", GLOB_ONLYDIR));
  </code></pre>
  
  <p>Works well but reads directory twice (even if there are <a href="http://php.net/manual/en/function.clearstatcache.php" rel="noreferrer">some optimizations</a> that make the second browsing quicker).</p>