coffee writing computer blogging

List all the months in order with PHP

List all the months in order in PHP using array. You may copy and paste for fast coding in some case. PHP is a general-purpose scripting language especially suited to web development.

$months = array(
    'January',
    'February',
    'March',
    'April',
    'May',
    'June',
    'July ',
    'August',
    'September',
    'October',
    'November',
    'December',
);


Using PHP Coding and Loop

for( $m=1; $m<=12; ++$m ) {
    echo date( 'F', mktime( 0, 0, 0, $m, 1 ) ).'<br>';
}

Tags:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top