3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dt = DateTime::createFromFormat('u', '123'); var_dump($dt); var_dump(DateTime::getLastErrors());
Output for 8.2.0 - 8.2.19, 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
object(DateTime)#1 (3) { ["date"]=> string(26) "2020-04-08 00:00:00.123000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
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 object(DateTime)#1 (3) { ["date"]=> string(26) "2020-04-08 00:00:00.123000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false)
Output for 7.3.0 - 7.3.31, 7.3.33, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28
object(DateTime)#1 (3) { ["date"]=> string(26) "2020-04-08 00:00:00.123000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } array(4) { ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(0) ["errors"]=> array(0) { } }
Output for 7.3.32, 7.4.26, 8.0.13
object(DateTime)#1 (3) { ["date"]=> string(26) "2020-04-08 00:00:00.123000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } array(4) { ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(0) ["errors"]=> array(0) { } }
Output for 5.4.30 - 5.4.31, 5.4.33 - 5.4.45, 5.5.14 - 5.5.23, 5.5.25 - 5.5.27, 5.5.29 - 5.5.37, 5.6.0 - 5.6.28, 5.6.30 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.29, 7.1.31 - 7.1.33, 7.2.0 - 7.2.22, 7.2.24 - 7.2.33
object(DateTime)#1 (3) { ["date"]=> string(26) "2020-04-08 13:01:02.123000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } array(4) { ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(0) ["errors"]=> array(0) { } }
Output for 5.4.32, 5.5.24, 5.5.28, 5.5.38, 5.6.29, 7.1.30, 7.2.23
object(DateTime)#1 (3) { ["date"]=> string(26) "2020-04-08 13:01:03.123000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } array(4) { ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(0) ["errors"]=> array(0) { } }
Output for 5.3.0, 5.3.3 - 5.3.26, 5.3.28 - 5.3.29, 5.4.0 - 5.4.9, 5.4.11 - 5.4.24, 5.4.26 - 5.4.29, 5.5.0 - 5.5.13
object(DateTime)#1 (3) { ["date"]=> string(19) "2020-04-08 13:01:02" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } array(4) { ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(0) ["errors"]=> array(0) { } }
Output for 5.3.27, 5.4.10, 5.4.25
object(DateTime)#1 (3) { ["date"]=> string(19) "2020-04-08 13:01:03" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } array(4) { ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(0) ["errors"]=> array(0) { } }
Output for 5.3.1 - 5.3.2
bool(false) array(4) { ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(1) ["errors"]=> array(1) { [0]=> string(42) "A six digit millisecond could not be found" } }
Output for 5.2.10 - 5.2.17
Fatal error: Call to undefined method DateTime::createFromFormat() in /in/sNTP8 on line 3
Process exited with code 255.
Output for 5.2.0 - 5.2.9
Fatal error: Call to undefined method DateTime::createfromformat() in /in/sNTP8 on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/sNTP8 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Undefined class name 'datetime' in /in/sNTP8 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Undefined class name 'datetime' in /in/sNTP8 on line 3

preferences:
275.85 ms | 401 KiB | 461 Q