PHP Date Output Months

Like this blog? Consider exploring one of our sponsored banner ads...

Here is a fun way to output the months of the year by generating an arbitrary date then using the date() function to get the textual month name. This si a clean way to populate a month list menu or any other calendar functionality:

for($i=1; $i<=12; $i++){
     $month = date('F',mktime(0, 0, 0, $i, 11, 1978));
}

About this entry