title: how to folder sort out by time php
body: <p>how to folder sortout by time example i create last/latest folder in directory so last folder show on top.</p>
  
  <p>here is code to show directory only</p>
  
  <pre><code>&lt;?php
  
  function folderlist(){
    $startdir = './';
    $ignoredDirectory[] = '.'; 
    $ignoredDirectory[] = '..';
     if (is_dir($startdir)){
         if ($dh = opendir($startdir)){
             while (($folder = readdir($dh)) !== false){
                 if (!(array_search($folder,$ignoredDirectory) &gt; -1)){
                   if (filetype($startdir . $folder) == "dir"){
                         $directorylist[$startdir . $folder]['name'] = $folder;
                         $directorylist[$startdir . $folder]['path'] = $startdir;
                     }
                 }
             }
             closedir($dh);
         }
     }
  return($directorylist);
  }
  
  
  $folders = folderlist();
      foreach ($folders as $folder){
      $path = $folder['path'];
      $name = $folder['name'];
  
  echo '&lt;li&gt;&lt;a href="' .$path .'index.php?album=' .$name . '" class="style1"&gt;&lt;font face="Tahoma" class="ws10"&gt;&lt;B&gt;' . $name . '&lt;/B&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;';
    }
  ?&gt;
  </code></pre>