get month name in PHP

This is a very simple but usefull function to get the name og month from the number.


function monthName($mon){

        $mname = date( 'F', mktime(0, 0, 0, $mon) );
        return $mname;
}

to test this code try the following


echo 'Current Month:'.monthName(date("m"));
echo 'XMAS is on' .monthName(12);
echo '<a herf="http://samplephpcodes.com">PHP Codes</a>';
Next Page »