I have a directory with files.
Files have the following name structure:
report_zone3_051709.doc
report_zone4_061208.doc
Currently I display the list of all reports in the directory by building an array first:
$dirHandle=opendir('/mydir/reports');
while ($file = readdir($dirHandle)) {
if (($file != '.') && ($file != '..') ) {
$month = substr($file, -10, 2);
$day = substr($file, -8, 2);
$year = substr($file, -6, 2);
$array[$file] = strtotime($year . $month . $day);
}
}
arsort($array);
I'd like to be able to show only reports by certain year. Say I have a var set:
$year = 09;
Not sure how to do that.