php list array by random date
389
I need to list an array by date, this is what I have so far which spits out the image name and gives it a random date:
$images = glob('images/{*.jpg,*.gif,*.png}', GLOB_BRACE);
foreach($images as $image)
{
$image = str_replace('images/','',$image);
$date = date('Y-m-d', strtotime( '-'.mt_rand(0,1351).' days'));
$result = $image . '<br />' . $date . '<br /><br />';
echo $result;
}
Example:
16631824.jpg
2008-04-23
17122028.jpg
2007-12-31
1854815.jpg
2007-10-13
1gaffuv.jpg
2009-04-12
3rekel7c.jpg
2010-06-13
Now I just need help listing it by date ...as always any help is appreciated.
Answer
Solution:
Answer
Solution:
Create an array of images, using the date as the key, and then sort the keys before output.