Possible Duplicate:
How to increment date with 1 (day/year) in PHP?
Im not really sure where to begin with this but im trying to make a year start at 1928 and stop at 1948 and for every year the years increment by one so since its 2012 the date ranges are 1928 – 1948 and for 2013 it would be 1929 – 1949 and 2014 would be 1930 – 1950 and so on…
right now i just have a basic loop for when to start and stop the years but its not too dynamic, like i said im pretty much at a blank on where to begin other then date(‘Y’)+1.
for($i=1928;$i<=date('Y');$i++)
{
echo '<option value='.$i.'>'.$i.'</option>';
if($i == '1948'){break;}
}
So you want it to go between current year minus 84 and the current year minus 64? Use this code:
Edit: updated for performance. Current year is determined before the loop (per Pitchinnate’s comment).