Printing the Name of a Month according to the Numeric Value (ie: mm)

Category: Software and Systems Engineering
Author: Sean O'Donnell
Thu, Feb. 20th, 2003 @ 2:20:22 (MST)

This example will show you a simple home-made function that returns the name of a month from the numeric value.

<?php
/**
 * @function get_name_month($int_Month)
 * @param int Numerical Month Value (MM)
 * @returns string Month Name
 * @author Sean O'Donnell http://www.seanodonnell.com/code/
*/
function get_name_month($int_Month) {
    if (
is_numeric($int_Month)) {
        return 
date("F",mktime (0,0,0,$int_Month,1));
    } else {
        return 
$int_Month;
    }
}
print 
get_name_month(12);
?>

The results from the example above, should be:

December

Copyleft (<) 1998-2019 www.seanodonnell.com