Using PHP I'm trying to echo each year since 2006 minus the current year; the result would be something like: 2006 2007 2008 2009 2010 2011 2012. I'm needing a foreach loop so I can rap each result in a <li>
. I'm not sure exactly how to achieve this result.
0
votes
1 Answers
0
votes
take a look at DatePeriod and DateInterval
After that take a look at Negative DateInterval (KingCrunch's answer)
IMO this is the cleanest way.
for($i=2006; $i<date("Y"); ++$i){echo "<li>$i</li>";}
work? – Voitcus