In other words, you wanted a less efficient way of going about the answer that you received instead:
function yearMonth($start_date, $end_date)
$begin = new DateTime( $start_date );
$end = new DateTime( $end_date);
$interval = new DateInterval('P1D'); // 1 month interval
$period = new DatePeriod($begin, $interval, $end);
$aResult = array();
foreach ( $period as $dt )
$aResult[$dt->format('Y')][$dt->format('F')] = $dt->format('d');
EDIT: Woops, guess it's a bit more than that since you wanted a partial return for the months at the start and end of the range. Okay...
EDIT2: Was over thinking it... and got fooled by the incorrect "1 month interval" code comment. Corrected code snippet above.