It is my feeling that GetMonth() has more utility than plain old date( 'n' ). For example with GetMonth() I can get the digit of any month just by passing a simple string. I'd like to see date( 'n' ) manage that. It'd involve some sort of strtotime() toomfoolery not to mention hefty use of GNU date formats. So thus follows a bout of silly testing
function GetMonth($month) {
switch ($month) {
case "January":
$foothis=1;
break;
case "February":
$foothis=2;
break;
case "March":
$foothis=3;
break;
case "April":
$foothis=4;
break;
case "May":
$foothis=5;
break;
case "June":
$foothis=6; // I'll save you the inidignity of the remainder...
break;
}
return $foothis;
}
$runs = 6;
$months = array( 0, 'January', 'February', 'March', 'April', 'May', 'June' );
list($usec, $sec) = explode(' ', microtime());
$start = ((float)$usec + (float)$sec);
for( $i = 1; $i <= $runs; $i++ )
{
GetMonth( $months[$i] );
}
list($usec, $sec) = explode(' ', microtime());
$end = ((float)$usec + (float)$sec);
$time1 = $end - $start;
list($usec, $sec) = explode(' ', microtime());
$start = ((float)$usec + (float)$sec);
for( $i = 1; $i <= $runs; $i++ )
{
date( 'n', strtotime( '1 ' . $months[$i] . ' 2006' ));
}
list($usec, $sec) = explode(' ', microtime());
$end = ((float)$usec + (float)$sec);
$time2 = $end - $start;
echo $time1 . ' ' . $time2;
:evilgrin: