3v4l.org

run code in 300+ PHP versions simultaneously
<?php $timezone = new \DateTimeZone('Europe/Paris'); $periodStart = (new \DateTimeImmutable('2024-10-21'))->setTimezone($timezone)->setTime(00, 00, 00); $periodEnd = (new \DateTimeImmutable('2024-10-27'))->setTimezone($timezone)->setTime(23, 59, 59); var_dump($periodStart); var_dump($periodEnd); var_dump($timezone->getOffset($periodStart)); var_dump($timezone->getOffset($periodEnd)); var_dump($periodStart->diff($periodEnd)->format('%y years %m months %a days %H hours %I minutes %s seconds'));
Output for git.master, git.master_jit
object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2024-10-21 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(12) "Europe/Paris" } object(DateTimeImmutable)#3 (3) { ["date"]=> string(26) "2024-10-27 23:59:59.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(12) "Europe/Paris" } int(7200) int(3600) string(54) "0 years 0 months 6 days 23 hours 59 minutes 59 seconds"

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