Im using this code to list all the images in a folder on the page, the class "results" holds the 4 images per paginated page. I can only get them to list in alphabetical order, how can I get them by most recently added?
<?php
$files = glob("upload_image/*.*");
for ($i = 0; $i < count($files); $i += 4) {
$colCnt++;
if ($colCnt == 1) {
$num = $files[$i];
}
echo '<div class="result"><img src="' . $files[$i] .
'" /><img src="' . $files[$i + 1] .
'" /><img src="' . $files[$i + 2] .
'" /><img src="' . $files[$i + 3].'" /> ';
echo'</div>';
if ($colCnt == 1) {
$colCnt = 0;
}
}
?>