Hi, this script is suppose to read a directory and display the files in descending order with a limit of 20 files shown.
For some reason, it displays a blank page. Can someone please help me fixer up.
thanx
<?php
$handle=opendir('.');
while (false!=($file = readdir($handle)))
{
if ($file != "." && $file != ".." && ereg(".xml",$file))
{
$file_array[$file]= fileatime($file); //STORING
}
}
closedir($handle);
arsort($file_array, SORT_NUMERIC); //sort file array based on timestamp in descending order.
reset($file_array);
$i =0;
foreach($file_array,$item)
{
if($i < 20)
print $item;
$i++;
}
?>