3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dt = new DateTime('2014-10-26T02:30', new DateTimeZone('Europe/Brussels')); echo $dt->format(DateTime::ISO8601); // 2014-10-26T02:30:00+0100 echo $dt->getTimestamp(); // 1414287000 echo $dt->getOffset(); // 3600 echo $dt->getTimeZone->getName(); // Europe/Paris $date1 = new DateTime("@1451382400"); // Sun Oct 28 2012 02:00:00 GMT+2 (DST) var_dump($date1->getTimestamp()); //prints: 1351382400 $date1->setTimezone(new DateTimeZone("Europe/Stockholm")); var_dump($date1->getTimestamp()); //prints: 1351386000
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
2014-10-26T02:30:00+010014142870003600 Warning: Undefined property: DateTime::$getTimeZone in /in/korXi on line 7 Fatal error: Uncaught Error: Call to a member function getName() on null in /in/korXi:7 Stack trace: #0 {main} thrown in /in/korXi on line 7
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 2014-10-26T02:30:00+010014142870003600 Warning: Undefined property: DateTime::$getTimeZone in /in/korXi on line 7 Fatal error: Uncaught Error: Call to a member function getName() on null in /in/korXi:7 Stack trace: #0 {main} thrown in /in/korXi on line 7
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
2014-10-26T02:30:00+010014142870003600 Notice: Undefined property: DateTime::$getTimeZone in /in/korXi on line 7 Fatal error: Uncaught Error: Call to a member function getName() on null in /in/korXi:7 Stack trace: #0 {main} thrown in /in/korXi on line 7
Process exited with code 255.
Output for 7.3.32 - 7.3.33
2014-10-26T02:30:00+010014142870003600 Fatal error: Uncaught Error: Call to a member function getName() on null in /in/korXi:7 Stack trace: #0 {main} thrown in /in/korXi on line 7
Process exited with code 255.
Output for 5.6.0 - 5.6.40
2014-10-26T02:30:00+010014142870003600 Notice: Undefined property: DateTime::$getTimeZone in /in/korXi on line 7 Fatal error: Call to a member function getName() on null in /in/korXi on line 7
Process exited with code 255.
Output for 5.5.0 - 5.5.38
2014-10-26T02:30:00+010014142870003600 Notice: Undefined property: DateTime::$getTimeZone in /in/korXi on line 7 Fatal error: Call to a member function getName() on a non-object in /in/korXi on line 7
Process exited with code 255.

preferences:
222.54 ms | 401 KiB | 330 Q