3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $time = mktime(0, 0, 0, 1, 1); for ($i = 0; $i < 86400; $i += 1800) { // 1800 = half hour, 86400 = one day printf('<option value="%1$s-%2$s">%1$s-%2$s</option>', date('g:i', $time + $i), date('g:i a', $time + $i + 1800)); } ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
<option value="12:00-12:30 am">12:00-12:30 am</option><option value="12:30-1:00 am">12:30-1:00 am</option><option value="1:00-1:30 am">1:00-1:30 am</option><option value="1:30-2:00 am">1:30-2:00 am</option><option value="2:00-2:30 am">2:00-2:30 am</option><option value="2:30-3:00 am">2:30-3:00 am</option><option value="3:00-3:30 am">3:00-3:30 am</option><option value="3:30-4:00 am">3:30-4:00 am</option><option value="4:00-4:30 am">4:00-4:30 am</option><option value="4:30-5:00 am">4:30-5:00 am</option><option value="5:00-5:30 am">5:00-5:30 am</option><option value="5:30-6:00 am">5:30-6:00 am</option><option value="6:00-6:30 am">6:00-6:30 am</option><option value="6:30-7:00 am">6:30-7:00 am</option><option value="7:00-7:30 am">7:00-7:30 am</option><option value="7:30-8:00 am">7:30-8:00 am</option><option value="8:00-8:30 am">8:00-8:30 am</option><option value="8:30-9:00 am">8:30-9:00 am</option><option value="9:00-9:30 am">9:00-9:30 am</option><option value="9:30-10:00 am">9:30-10:00 am</option><option value="10:00-10:30 am">10:00-10:30 am</option><option value="10:30-11:00 am">10:30-11:00 am</option><option value="11:00-11:30 am">11:00-11:30 am</option><option value="11:30-12:00 pm">11:30-12:00 pm</option><option value="12:00-12:30 pm">12:00-12:30 pm</option><option value="12:30-1:00 pm">12:30-1:00 pm</option><option value="1:00-1:30 pm">1:00-1:30 pm</option><option value="1:30-2:00 pm">1:30-2:00 pm</option><option value="2:00-2:30 pm">2:00-2:30 pm</option><option value="2:30-3:00 pm">2:30-3:00 pm</option><option value="3:00-3:30 pm">3:00-3:30 pm</option><option value="3:30-4:00 pm">3:30-4:00 pm</option><option value="4:00-4:30 pm">4:00-4:30 pm</option><option value="4:30-5:00 pm">4:30-5:00 pm</option><option value="5:00-5:30 pm">5:00-5:30 pm</option><option value="5:30-6:00 pm">5:30-6:00 pm</option><option value="6:00-6:30 pm">6:00-6:30 pm</option><option value="6:30-7:00 pm">6:30-7:00 pm</option><option value="7:00-7:30 pm">7:00-7:30 pm</option><option value="7:30-8:00 pm">7:30-8:00 pm</option><option value="8:00-8:30 pm">8:00-8:30 pm</option><option value="8:30-9:00 pm">8:30-9:00 pm</option><option value="9:00-9:30 pm">9:00-9:30 pm</option><option value="9:30-10:00 pm">9:30-10:00 pm</option><option value="10:00-10:30 pm">10:00-10:30 pm</option><option value="10:30-11:00 pm">10:30-11:00 pm</option><option value="11:00-11:30 pm">11:00-11:30 pm</option><option value="11:30-12:00 am">11:30-12:00 am</option>