I move a site to a new server and noticed that one of my functions is not functioning properly.
Basically it's a function that lists files in a directory.
Filenames contact date and month:
0208 -- Feb. 2008
Here's the original code that used to work fine on the old server:
$dirHandle=opendir('/myfile/');
while ($file = readdir($dirHandle)) {
if (($file != '.') && ($file != '..')) {
$month = substr($file, -8, 2);
$year = substr($file, -6, 2);
$array[$file] = strtotime($year . $month . '01');
}
}
arsort($array);
foreach ($array as $key => $value) {
$month_and_year = date('F Y', $value);
echo "<a href='myfile/" . $key ."'>" . $month_and_year . "</a><br />";
}
closedir($dirHandle);
Unfortunately, right now I get the correct number of links but they all say December 2008
December 2008
December 2008
December 2008
December 2008