/* function date_difference calculates the difference between two dates in years, months, and days. There is a ColdFusion funtion called, I believe, date_diff() which performs a similar function.
It does not make use of 32-bit unix timestamps, so it will work for dates outside the range 1970-01-01 through 2038-01-19. This function works by taking the earlier date finding the maximum number of times it can increment the years, months, and days (in that order) before reaching the second date. The function does take yeap years into account, but does not take into account the 10 days removed from the calendar (specifically October 5 through October 14, 1582) by Pope Gregory to fix calendar drift.
As input, it requires two associative arrays of the form: array ( 'year' => year_value, 'month' => month_value. 'day' => day_value)
The first input array is the earlier date, the second the later date. It will check to see that the two dates are well-formed, and that the first date is earlier than the second.
If the function can successfully calculate the difference, it will return an array of the form: array ( 'years' => number_of_years_different, 'months' => number_of_months_different, 'days' => number_of_days_different)
If the function cannot calculate the difference, it will return FALSE.