3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Input data $startTimestamp = '2023-08-05 14:45:05'; $endTimestamp = '2023-08-09 13:00:14'; // The interval expressed using `DateTime` objects $begin = new DateTimeImmutable($startTimestamp); $end = new DateTimeImmutable($endTimestamp); // The beginning of the first day (midnight) $start = $begin->setTime(0, 0, 0); // What its name says $oneDay = new DateInterval('P1D'); $output = []; // Check each day of the interval [$start, $end) $period = new DatePeriod($start, $oneDay, $end); foreach ($period as $day) { $s = max($day, $begin); // day start (midnight, except for the first day) $e = min($end, $day->add($oneDay)); // day end (midnight, except for the last day) $l = $e->diff($s); // day length // Express the day length in minutes $output[$day->format('Y-m-d')] = 24 * 60 * $l->d + 60 * $l->h + $l->i + round($l->s / 60); } print_r($output);
Output for git.master, git.master_jit
/bin/php-git-master: error while loading shared libraries: libonig.so.5: cannot open shared object file: No such file or directory
Process exited with code 127.
Output for rfc.property-hooks
Array ( [2023-08-05] => 555 [2023-08-06] => 1440 [2023-08-07] => 1440 [2023-08-08] => 1440 [2023-08-09] => 780 )

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:
37.44 ms | 406 KiB | 5 Q