title: List directories by date and it drops a single item from array... am I missing something?
body: <p>Code:</p>
  
  <pre><code>    $files = array();
      $dir = new DirectoryIterator($directory);
      foreach ($dir as $fileinfo) {
         $files[$fileinfo-&gt;getMTime()] = $fileinfo-&gt;getFilename();
      }
  
      //krsort will sort in reverse order
      krsort($files);
  
      foreach($files as $file){
          if ($file == "." or $file == ".." or $file == "thumbs" or $file == "Thumbs.db" or strpos($file, '.') == TRUE){
          }else{
              if (file_exists($directory.$file.'/zconfirmed.txt')){
                  echo '&lt;script&gt;console.log("display_subdirectories.php says: '.$directory.$file.'/zconfirmed.txt");&lt;/script&gt;&lt;li class=""&gt;&lt;a class="w3-btn w3-green" href="' .$URL.$file. '" &gt;' .$file. '&lt;/a&gt;&lt;/li&gt;';
              }
              else{
                  echo '&lt;script&gt;console.log("display_subdirectories.php says: '.$directory.$file.'");&lt;/script&gt;&lt;li class="bold"&gt;&lt;a class="w3-btn w3-red" href="' .$URL.$file. '" &gt;' .$file. '&lt;/a&gt;&lt;/li&gt;';
              }
          }
      }
  </code></pre>
  
  <p>Here's My problem. If there is only 1 directory that has the zconfirmed.txt file in it, it doesn't appear when I iterate through the array. If there are 2 or more, it works just fine. Anybody have an answer or even something I can do to better troubleshoot this code?</p>
  
  <p>I'm just trying to list the directories in the order of their last modified date/time.</p>
  
  <p>Thank you guys so much for the help!</p>