Problems within strtotime would cause that. You can see it when running this:
echo date("m/d/Y", strtotime("2005-10-31 +1 month"));
It returns 12/01/2005
It's really up to you at this point what to do. The suggestion for months within an array would be the best bet, but if you wanted to keep it based completely off of php's date and time functions, you could modify the increment and perform another check within this function.
And you will have to forgive me for even posting it, since I was mainly just kind of screwing around. But something like this..
function get_months($date1, $date2) {
$time1 = strtotime($date1);
$time2 = strtotime($date2);
$my = date('mY', $time2);
$months = array(date('F', $time1));
$f = '';
while($time1 < $time2) {
$time1 = strtotime((date('Y-m-d', $time1).' +15days'));
if(date('F', $time1) != $f) {
$f = date('F', $time1);
if(date('mY', $time1) != $my && ($time1 < $time2))
$months[] = date('F', $time1);
}
}
$months[] = date('F', $time2);
return $months;
}