Do you want a function to calculate all the years between two given dates? If so, this should do it:
<?PHP
function find_years($year1, $year2) {
$return = false;
if ($year2 >= $year1) {
$diff = $year2 - $year1;
$return = array();
for ($i = 0; $i <= $diff; $i++) {
$return[] = $year1+$i;
}
}
return $return;
}
print_r(find_years('1990','2008'));
?>
Returns either boolean false or an array of all the years in increasing order.
Edit: The above code snippet outputs this, btw:
Array
(
[0] => 1990
[1] => 1991
[2] => 1992
[3] => 1993
[4] => 1994
[5] => 1995
[6] => 1996
[7] => 1997
[8] => 1998
[9] => 1999
[10] => 2000
[11] => 2001
[12] => 2002
[13] => 2003
[14] => 2004
[15] => 2005
[16] => 2006
[17] => 2007
[18] => 2008
)
Edit: I've re-read the thread three times now, and I'm still not sure what you want. This is a pretty simple function, though - all you'd need to do to do what I think you're asking to do would be something like $years = find_years($first_year, date('Y')); where $first_year is the first year you want to start at (something about seventeen years ago? - $first_year = date('Y') - 17; ) and the second argument is the last year you want to show (date('Y') being the current year). Let me know if that helps 😃