Kathmandu,Nepal
Kathmandu,Nepal

Display all list month of name using php

Example 1:

<?php

for($m=1; $m<=12; ++$m){
echo date('F', mktime(0, 0, 0, $m, 1)).'<br>';
}?>
Output:
January
February
March
April
May
June
July
August
September
October
November
December

Example 2:

<?php
$month_names = array("January","February","March","April","May","June","July","August","September","October","November","December");

foreach($month_names as $month){
echo $month."<br>";
}
?>
Output:
January 
February 
March 
April 
May 
June 
July 
August
September
October 
November 
December

Leave a Comment

Your email address will not be published. Required fields are marked *

×