3v4l.org

run code in 300+ PHP versions simultaneously
<?php $period_durations = [ 'every_2_hours' => 2, 'every_4_hours' => 4, 'every_8_hours' => 8, ]; $period = 'every_8_hours'; $hour = (int) date('G'); $duration = $period_durations[$period]; $hour = ((int)($hour/$duration)+1)*$duration; // drop remainder $dateTime = new DateTime(); $dateTime->setTime($hour, 0, 0); print_r($dateTime);
Output for git.master, git.master_jit, rfc.property-hooks
DateTime Object ( [date] => 2015-05-14 00:00:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
52.06 ms | 401 KiB | 8 Q