Currently I have a script that looks through directory for particular file type and displays info via loop, like this:
$source_folder = '../mydirectory';
$FILES = glob("$source_folder/*.png");
foreach($FILES as $key => $file) {
$FILE_LIST[$key]['name'] = basename(substr( $file, ( strrpos( $file, "\\" ) +1 ) ), ".png");
$FILE_LIST[$key]['date'] = date("M j, Y", filemtime( $file ) );
$FILE_LIST[$key]['datestamp'] = date("Ymd", filemtime( $file ) );
}
foreach ($FILE_LIST as $value) {
// display file info here
}
Currently this script will show all files in directory that match criteria. If I have a limit of how many to display ($fileLimit = 3😉 how would I apply this to the previous code?