Code: Select all
$current_year = intval(date('Y', time()));
$mon_options = '<option value="">Month</option>';
$year_options = '<option value="">Year</option>';
//Make the year_array
for ($x = 0; $x < 10; $x++)
{
$Y = date('Y', mktime(0,0,0,0,0, $current_year, 0));
$y = date('y', mktime(0,0,0,0,0, $current_year, 0));
$year_arrayї$y] = $Y;
$current_year++;
}
var_dump($year_array);outputs
Code: Select all
array(10) {
ї"04"]=>
string(4) "2004"
ї"05"]=>
string(4) "2005"
ї"06"]=>
string(4) "2006"
ї"07"]=>
string(4) "2007"
ї"08"]=>
string(4) "2008"
ї"09"]=>
string(4) "2009"
ї10]=>
string(4) "2010"
ї11]=>
string(4) "2011"
ї12]=>
string(4) "2012"
ї13]=>
string(4) "2013"
}