hmm... the problem seems interesting enough, so I would like to propose an entirely different solution:
<?php
function testCodeToTimes($testcode, $year = 2008)
{
static $day_names = array('monday', 'tuesday', 'wednesday', 'thursday',
'friday', 'saturday', 'sunday');
static $week_numbers = array('first', 'second', 'third', 'fourth', 'fifth');
static $month_names = array('jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul',
'aug', 'sep', 'oct', 'nov', 'dec');
$base_month = $testcode[2];
$base_day = $week_numbers[$testcode[3] - 1] . ' '
. $day_names[$testcode[4] - 1] . ' ';
$month = 3 * ($testcode[0] - 1) + $base_month - 1;
$test_times[] = strtotime($base_day . $month_names[$month] . ' ' . $year);
$month = 3 * ($testcode[1] - 1) + $base_month - 1;
$test_times[] = strtotime($base_day . $month_names[$month] . ' ' . $year);
return $test_times;
}
$test_times = testCodeToTimes("24343", 2009);
echo date('l, F jS, Y', $test_times[0]) . "<br \n>"
. date('l, F jS, Y', $test_times[1]);
?>
My idea is to change the test code string like "24343" into "fourth wednesday june 2009" and "fourth wednesday december 2009", and then use strtotime() to convert them into a timestamp, upon which you have more options for formatting.