You can use glob() to get an array of filenames then use usort() and filectime() to order them by their creation dates:
$files = glob('*.markdown');
usort($files, function($file_1, $file_2)
{
$file_1 = filectime($file_1);
$file_2 = filectime($file_2);
if($file_1 == $file_2)
{
return 0;
}
return $file_1 < $file_2 ? 1 : -1;
});
For PHP versions lower than 5.3:
function sortByCreationTime($file_1, $file_2)
{
$file_1 = filectime($file_1);
$file_2 = filectime($file_2);
if($file_1 == $file_2)
{
return 0;
}
return $file_1 < $file_2 ? 1 : -1;
}
$files = glob('*.markdown');
usort($files, 'sortByCreationTime');