How to list all images in a folder, sorted

PHP script

This PHP script lists all images in a folder, in descending order. The files are shown as images.

<?php
array_multisort(array_map('filemtime', ($files = glob("*.jpg"))), SORT_DESC, $files);
foreach($files as $filename)
{
    echo "<a href='http://nerdegutta.org/".substr($filename, 0, -4).".jpg'><img src='http://nerdegutta.org/".substr($filename, 0, -4).".jpg' width='200'></a> ";
}
?>

blogroll

social