title: Loop throught directory and subdir
body: <p>Pls sir, how can I loop through a directory and get the sub-directory name and all the files names so that I can generate a directory try, am trying to build a file manager in php.</p>
  
  <p>I have tried:</p>
  
  <pre><code>$dir = new DirectoryIterator(dirname(FILE));
  foreach ($dir as $fileinfo) {
      if (!$fileinfo-&gt;isDot()) {
          var_dump($fileinfo-&gt;getFilename());
      }
  } 
  </code></pre>