Code: Select all
$days = array(
2=>array('01022007.pdf','linked-day'),
3=>array('01032007.pdf','linked-day'),
8=>array('01082007.pdf','linked-day'),
22=>array('01222007.pdf','linked-day'),
);Code: Select all
Array
(
[2] => Array
(
[0] => 01022007.pdf
[1] => linked-day
)
)Now what I need to do is find all the files that have a day in each month. So all the days in month '01' and sort them together. Then I need to create an array like the one above from the multidimensional array:
Code: Select all
Array
(
[] => Array
(
[filename] => 09112006.pdf
[day] => 11
[month] => 09
[year] => 2006
)
[1] => Array
(
[filename] => 11212006.pdf
[day] => 21
[month] => 11
[year] => 2006
)
[2] => Array
(
[filename] => 05022007.pdf
[day] => 02
[month] => 05
[year] => 2007
)
)Code: Select all
$dir = 'notices';
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file == (substr($file, -3) == 'pdf')) {
if (is_dir("$dir/$file")) {
$folder_array[] = strtolower($file);
} else {
$file_array[$i]['filename'] = strtolower($file);
$file_array[$i]['day'] = substr($file, 2,2);
$file_array[$i]['month'] = substr($file, 0,2);
$file_array[$i]['year'] = substr($file, 4, 4);
}
}
$i ++;
}
closedir($handle);
}