3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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', ]; $b = $a->setTime(10, 0)->setTimezone("+03:00"); var_dump($a > $b, $a, $b); var_dump($a->getTimestamp()); var_dump($b->getTimestamp()); var_dump($a > $b, $a, $b);
based on PKhKl
Output for 7.0.0 - 7.2.0
Warning: DateTimeImmutable::setTimezone() expects parameter 1 to be DateTimeZone, string given in /in/ssATV on line 12 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" } bool(false) int(1420099200) Fatal error: Uncaught Error: Call to a member function getTimestamp() on boolean in /in/ssATV:16 Stack trace: #0 {main} thrown in /in/ssATV on line 16
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Warning: DateTimeImmutable::setTimezone() expects parameter 1 to be DateTimeZone, string given in /in/ssATV on line 12 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" } bool(false) int(1420099200) Fatal error: Call to a member function getTimestamp() on boolean in /in/ssATV on line 16
Process exited with code 255.
Output for 5.5.24 - 5.5.35
Warning: DateTimeImmutable::setTimezone() expects parameter 1 to be DateTimeZone, string given in /in/ssATV on line 12 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" } bool(false) int(1420099200) Fatal error: Call to a member function getTimestamp() on a non-object in /in/ssATV on line 16
Process exited with code 255.
Output for 5.4.11 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/ssATV on line 5
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/ssATV on line 7
Process exited with code 255.