title: PHP - Ordering List of Directories by Modified Date
body: <p>This is my current effort to get a list of files from an (Apache) server, and sort them into reverse modified order.</p>
  <p>It works flawlessly, but why doesn't the reverse sort work with a list of directories? It lists them fine but doesn't order them.</p>
  <pre><code>&lt;?php 
  function getFiles(){
      $files=array();
      if($dir=opendir('.')){
          while($file=readdir($dir)){
              if (!in_array($file,array(&quot;.&quot;,&quot;..&quot;,&quot;index.php&quot;))) {
                  $files[]=$file;
              }
          }
  
          closedir($dir);
  
      }
      
      rsort($files); ##sort reverse modified
      return $files;
  }
  }
  ?&gt;
  </code></pre>