PHP Code:
<?php
$dir = 'video/archives';
$files = glob( $dir . '/*.*' );
// Sort files by modified time, latest to earliest
// Use SORT_ASC in place of SORT_DESC for earliest to latest
array_multisort(
array_map( 'filemtime', $files ),
SORT_NUMERIC,
SORT_DESC,
$files
);
for ($count_files = 0; $count_files < count($files); $count_files++) {
$file_contents[] = file_get_contents($dir . '/' . $files[$count_files]);
}
//then you should have contents of each file in the $file_contents array. If you want the most recent 'echo $file_contents[0];'
//if you want all 3 files you can use a for loop like I did or a foreach loop.
?>
Bookmarks