php show all images in directory and sort by last modified
<p>I have the following php script display all images in a directory</p>

<pre><code>&lt;?php
$images = glob($dirname."*.jpg");
foreach($images as $image) {
echo '&lt;img src="'.$image.'" height ="400"/&gt;&lt;br /&gt;';
}
?&gt;
</code></pre>

<p>I want to modify this so that when you visit the page it shows the last modified image on top. Could someone help me how I would go about doing that?</p>
