I have an array of dates that is filled with string formated days sorted in descending order varying one another 30 days. The 31-days months are already converted in 30-days months.
$monthdates = array('2001-29-05','2001-29-06','2001-29-07','2001-29-08','2001-29-09','2001-29-10');
I also have another array containing string formated days in descending order that are ranged within the dates in the above array like this:
$customdates = array('2001-30-05','2001-31-05','2001-01-06','2001-02-06',2001-03-06);
...say this array last value is '2001-29-11'.
What I want is inside a loop (or more likely two) to traverse the arrays and compare the $monthdates' current day with the day in the $customdates array and echo something (whatever) IF the day in the $customdates array is more recent and exactly 20 days than the day in the $monthdates array.
For example: '2001-30-05' in the $customdates array is more recent than '2001-29-05' in the $monthdates array. In that case, we should figure out these two days' numeric difference and if it exceeds 20 days(varying one another 20 or more days), then print a random string, while keep doing the above comparison FOR the every next value in the $customdates array.
If a "match" found for the $monthdates array, stop doing the comparison for its current value and move on to the next value. In our example the '2001-30-05' and the '2001-29-05' differ only 1 day. When we find a match for every value in the $monthdates array, get its next value.