function checkInterval(DateTime $begin, DateTime $end, $time)
{
$intervalDiff = $begin->diff($end);
$intervalMinutes = $intervalDiff->h * 60 + $intervalDiff->i;
if ($intervalMinutes >= $time ) {
$period = new DatePeriod($begin, new DateInterval("PT15M"), $end);
foreach ($period as $date) {
$start_time = clone $date;
$date->modify("+{$time} minute");
if ($date <= $end) {
echo $start_time->format("H:i"), "<br>\n";
}
}
}
}