Something like the snip below. You'll have to add some error trapping (empty dirs etc), but I leave that as a learning exp ;-)
// open the directory
$dir = opendir($dirpath) ;
// read the files into an array
$files = readdir($dir);
reverse sort the array
rsort $files;
// get the file
$file = $files[0];