dc_jt Posted November 27, 2007 Share Posted November 27, 2007 Hi Im looking to list all months of the year in reverse order for example for this month it will list like November October September August July June May April March Feb Jan December I have done the following which gets it in normal order Jan-Dec: $mnths = array('','January','February','March','April','May','June','July','August','September','October','November','December'); <?php for ($i=1;$i<=12;$i++) {?> <li><a href="<?=$_SERVER['PHP_SELF']?>?iMonth=<?=$i?>"><?=$mnths[$i]?></a></li> <?php }?> Anyone help? Thanks Quote Link to comment Share on other sites More sharing options...
dc_jt Posted November 27, 2007 Author Share Posted November 27, 2007 Its ok I got it using <?php for($i = 0;$i<12;$i++){ $time = strtotime("today - $i months");?> <li><a href="<?=$_SERVER['PHP_SELF']?>?iMonth=<?=date("m",$time)?>"><?=date("M",$time)?></a></li> <?php } ?> Thanks anyway Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.