How do I make PHP display files in the opposite order that readdir does?
<p>I'm using this to return images in the order they were added to the directory, however I want them to be ordered from newest to older. How can I do it? Thanks</p>

<pre><code>&lt;?
$handle = @opendir("images");

if(!empty($handle)) {
  while(false !== ($file = readdir($handle))) {
    if(is_file("images/" . $file))
      echo '&lt;img src="images/' . $file . '"&gt;&lt;br&gt;&lt;br&gt;';
  }
}

closedir($handle);
?&gt;
</code></pre>
