title: php DirectoryIterator sort files by date
body: <p>I'm using php's <code>DirectoryIterator</code> class to list files in a directory. I can't however figure out an easy way to sort files by date. How is this done with DirectoryIterator </p>
  
  <pre><code>&lt;?php
   $dir = new DirectoryIterator('.');
    foreach ($dir as $fileinfo) {     
       echo $fileinfo-&gt;getFilename() . '&lt;br&gt;';
     }
  ?&gt;
  </code></pre>
  
  <p>What if i name my files like whatever_2342345345.ext where the numbers represents time in milliseconds so each file has a unique number. How can we sort by looking at the numbers after underscore</p>