PHP Month Number to Month Name the Easy Way

Published 12th April 2009

Here’s a quickie for you. Ever wanted to convert a month number to a month name in PHP but hated having to do a huge switch statement? Well here is your answer.

$monthNum = 5; 
$monthName = date("F", mktime(0, 0, 0, $monthNum, 10));
echo $monthName; //output: May

Enjoy.