- range: documentation ( source)
<?php $options = array();
foreach (range(0,24) as $fullhour) {
$parthour = $fullhour > 12 ? $fullhour - 12 : $fullhour;
$parthour .= $fullhour > 11 ? " pm" : " am";
$options["$fullhour:00"] = $parthour;
$options["$fullhour:30"] = $parthour;
} ?>