simple image sorting

I am trying to display images in a directory showing the newest one uploaded first. The script below shows the oldest one first. Any help would be appreciated. I am very new.

[php]<?php

//Your folder
$files = glob(“images/.”);

$colCnt=0;
echo ‘

’;

for ($i=1; $i<count($files); $i++)
{
$colCnt++;
if ($colCnt==1)
echo ‘

’;
echo ‘’;

if ($colCnt==6)
{
echo ‘

’;
$colCnt=0;
}
}

echo ‘

’;

$num = $files[$i];

echo ’
random image'."  ";

echo ‘

’;
?>
[/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service