3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $seconds_in_hour = 60 * 60; $seconds_in_day = $seconds_in_hour * 24; $epoch = time(); $current_hour = $epoch % $seconds_in_day / $seconds_in_hour; echo $current_hour; if ($current_hour > 12) { $time_prefix = "pm"; $current_hour -= 12; } else { $time_prefix = "am"; } echo $current_hour; echo $time_prefix; ?>
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
13.7697222222221.7697222222222pm