$start = (new DateTime('08-10-2019'))->modify('first day of this month');
$end = (new DateTime('10-11-2019'))->modify('first day of next month');
$interval = DateInterval::createFromDateString('1 month');
$period = new DatePeriod($start, $interval, $end);
$countMonth = 0;
foreach ($period as $dt) {
echo $dt->format("Y-m") . "<br>\n";
++$countMonth;
}
echo $countMonth;