当前年份的PHP日期函数不能正常工作?

Ok so I was trying to have a form dropdown menu autoselect the current date without too much javascript coding, so I got the code below (it doesn't autoselect, but it does include the current date as the first options). The year wasn't showing up first like it was supposed to. I did the same for day and month, and those 2 worked perfectly, yet when I had the same code, except days / months in place of years (mday and mon inside brackets), the first year selection wasn't appearing. I'm guessing the problem is the part inside two instances of [$t['year']]. The rest of the code is functioning fine, but I just included it in case I missed something about it (I also tried replacing all years with the last their respective last 2 digits but same result).

<?php
$t = getdate(time()); 
$year = array(1 =>'2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024', '2025', '2026', '2027', '2028', '2029', '2030'); 

echo '&nbsp Year <select name="year" >'; 
echo '<option value="\" . $t[\'year\'] . \"">' . $year[$t['year']] . '</option>'; 
foreach( $year as $key => $value ) { 
    echo "<option value = \"$key\">$value</option>"; 
} 
echo '</select>'; ?>

Use date('Y').

http://php.net/manual/en/function.date.php

<?php
$t = getdate(time()); 
$year = array('2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024', '2025', '2026', '2027', '2028', '2029', '2030'); 

echo '&nbsp Year <select name="year" >'."
"; 
echo '<option value="' . array_search(date('Y'),$year) . '">' . date('Y') . '</option>'."
"; 
foreach( $year as $key => $value ) { 
    echo "<option value = \"$key\">$value</option>
"; 
} 
echo '</select>'."
";

?>

http://codepad.org/7h2MnxzC

This will also select just the one value in the select, so you don't need two:

<?php
$t = getdate(time()); 
$year = array('2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017', '2018', '2019', '2020', '2021', '2022', '2023', '2024', '2025', '2026', '2027', '2028', '2029', '2030'); 
$c_year = date('Y');

echo '&nbsp Year <select name="year" >'."
"; 
foreach( $year as $key => $value ) { 
    echo "<option".($c_year == $value?' selected="true"':'')." value = \"$key\">$value</option>
"; 
} 
echo '</select>'."
";

?>

http://codepad.org/uGx6zoyn

$years = range(2000, 2030);
$cur_year = date('Y');

echo '<select name="year">';
foreach($years as $year)
    if($year == $cur_year)
        echo "<option selected>$year</option>"; 
    else
        echo "<option>$year</option>";
echo '</select>';