From PHP manual: "There is no creation time for Unix files in most Unix filesystems". The closest to what you want would be this (written by heart, not tested - may have bugs):
$last = array(0, ""); // 2 items: time and name
$d = opendir($path);
while ($f = readdir($d))
// check extension - may be omitted if all files have ".txt" extension and
// there are no subdirs, but then you have to add if() for "." and ".." names
// (these are directories - you can use is_file() function
if (eregi(".txt$", $f)) {
$ctime = filectime("$path/$f");
if ($ctime > $last[0]) {
$last[0] = $ctime;
$last[1] = $f;
}
closedir($d);
Now, use file $path."/".$f as you wish.
If creation time is important to be exactly that (check manual for filectime() to see exactly what it returns), you'll have to log time creation for all your text files in some database or text file.
Good luck