3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr=array("2018-06-27 20:30:20","2018-06-27 20:31:20","2018-06-27 20:37:20","2018-06-27 20:45:20","2018-06-27 20:48:20"); function roundToNearestMinuteInterval($time, $interval) { $timestamp = strtotime($time); $rounded = round($timestamp / ($interval * 60), 0) * $interval * 60; return $rounded; } $interval = 5; // minutes $start = roundToNearestMinuteInterval(min($arr), $interval); $end = roundToNearestMinuteInterval(max($arr), $interval); for (; $start <= $end; $start += $interval * 60) { $results[] = date('Y-m-d H:i:s', $start); } print_r($results);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => 2018-06-27 20:30:00 [1] => 2018-06-27 20:35:00 [2] => 2018-06-27 20:40:00 [3] => 2018-06-27 20:45:00 [4] => 2018-06-27 20:50:00 )

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:
89.57 ms | 401 KiB | 8 Q