I've been working at this for hours with no luck. I'm trying to display every image from a directory in a reverse order, essentially newest to oldest.
I've been successful in displaying all the images but they display oldest to newest. I read somewhere that an array reverse would do the trick but I'm kind of new to PHP!
Any help is greatly appreciated.
Here is the code I have:
Code: Select all
<?php
$files = glob("photobooth/*.*");
for ($i=0; $i<count($files);
$i++) { $num = $files[$i];
echo '<img src="'.$num.'" alt="random image">'." "; }
?>