<?php
$start_time = new DateTime('09:00');
$close_time = new DateTime('21:00');
$periods = new DatePeriod($start_time, new DateInterval('PT30M'), $close_time);
foreach ($periods as $period) {
$times[] = $period->format('H:i');
}
// DatePeriod excludes the end time
$times[] = $close_time->format('H:i');
print_r($times);