in these days of PHP > 5 you should be using the provided classes for this kind of thing. For this particular task you should be using the FilesystemIterator for example:-
$iterator = new FilesystemIterator('D:/dev/');
foreach($iterator as $fileInfo){
if($fileInfo->isFile()){
$cTime = new DateTime();
$cTime->setTimestamp($fileInfo->getCTime());
echo $fileInfo->getFileName() . " file Created " . $cTime->format('Y-m-d h:i:s') . "<br/>\n";
}
if($fileInfo->isDir()){
$cTime = new DateTime();
$cTime->setTimestamp($fileInfo->getMTime());
echo $fileInfo->getFileName() . " dir Modified " . $cTime->format('Y-m-d h:i:s') . "<br/>\n";
}
}
Here $fileInfo
is an instance of SplFileInfo which can give you all the information about a file or directory you could ever want.