I needed a list of times like so in an array...
12am
12:30am
1:00pm
...
How can I do this with PHP?
We can simply use strtotime to increment our time by N amount here in this case 30 minutes and date function to format it to our desired output.
$startTime = strtotime('12 am');
$endTime = strtotime('11:59 pm');
$arrInterval = [];
while($endTime >= $startTime){
$arrInterval[] = date("h:ia", $startTime);
$startTime = strtotime('+30 minutes', $startTime);
}