Jump to content

[SOLVED] List months in reverse order


dc_jt

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/79062-solved-list-months-in-reverse-order/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.