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', ]; $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);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Fatal error: Uncaught TypeError: DateTimeImmutable::setTimezone(): Argument #1 ($timezone) must be of type DateTimeZone, string given in /in/ssATV:12 Stack trace: #0 /in/ssATV(12): DateTimeImmutable->setTimezone('+03:00') #1 {main} thrown in /in/ssATV on line 12
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught TypeError: DateTimeImmutable::setTimezone(): Argument #1 ($timezone) must be of type DateTimeZone, string given in /in/ssATV:12 Stack trace: #0 /in/ssATV(12): DateTimeImmutable->setTimezone('+03:00') #1 {main} thrown in /in/ssATV on line 12
Process exited with code 255.
Output for 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
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 bool in /in/ssATV:16 Stack trace: #0 {main} thrown in /in/ssATV on line 16
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33
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.

preferences:
148.78 ms | 402 KiB | 183 Q