Kanishka Panamaldeniya Kanishka Panamaldeniya - 1 month ago 8
PHP Question

is there a way to get month name by giving an integer value PHP

hi i am using PHP i want to pass an integer value (1-12) and get corresponding month name , is there a way in PHP to do that or i have to do t my own by initialize a month names array.

i want to do like

$month_name = get_month_name(1);

echo $month_name ; //echo january


thanks in advance

Answer
echo date('F', strtotime("2012-$int-01"));
Comments