3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('Europe/Minsk'); $a = new DateTimeImmutable("2015-01-01 11:00:00"); $daySchedule = [ 'from' => '10:00+03:00', 'till' => '21:00+03:00', ]; $from = explode(':', substr($daySchedule['from'], 0, 5)); $till = explode(':', substr($daySchedule['till'], 0, 5)); $fromTz = new \DateTimeZone(substr($daySchedule['from'], 5)); $tillTz = new \DateTimeZone(substr($daySchedule['till'], 5)); $b = $a->setTime($from[0], $from[1]); $b = $b->setTimezone($fromTz); var_dump($a > $b, $a, $b); var_dump($a->getTimestamp()); var_dump($b->getTimestamp()); var_dump($a > $b, $a, $b);
Output for git.master, git.master_jit, rfc.property-hooks
bool(true) object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-01-01 11:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(12) "Europe/Minsk" } object(DateTimeImmutable)#5 (3) { ["date"]=> string(26) "2015-01-01 10:00:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:00" } int(1420099200) int(1420095600) bool(true) object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2015-01-01 11:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(12) "Europe/Minsk" } object(DateTimeImmutable)#5 (3) { ["date"]=> string(26) "2015-01-01 10:00:00.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03: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:
39.45 ms | 402 KiB | 8 Q