3v4l.org

run code in 500+ PHP versions simultaneously
<?php var_dump(new DateTime('2000-10-20 11:22:33.12345')); var_dump(new DateTime('2000-10-20 11:22:33.123456')); var_dump(new DateTime('2000-10-20 11:22:33.1234567')); var_dump(new DateTime('2000-10-20 11:22:33.12345678')); var_dump(new DateTime('2000-10-20 11:22:33.123456789')); var_dump(new DateTime('2000-10-20 11:22:33.1234567891')); var_dump(new DateTime('2000-10-20 11:22:33.12345678912')); var_dump(DateTime::createFromFormat('Y-m-d H:i:s.u', '2000-10-20 11:22:33.12345')); var_dump(DateTime::createFromFormat('Y-m-d H:i:s.u', '2000-10-20 11:22:33.123456')); var_dump(DateTime::createFromFormat('Y-m-d H:i:s.u', '2000-10-20 11:22:33.1234567')); var_dump(DateTime::createFromFormat('Y-m-d H:i:s.u', '2000-10-20 11:22:33.12345678'));
Output for 8.0.10 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
object(DateTime)#1 (3) { ["date"]=> string(26) "2000-10-20 11:22:33.123450" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2000-10-20 11:22:33.123456" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2000-10-20 11:22:33.123456" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2000-10-20 11:22:33.123456" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2000-10-20 11:22:33.123456" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2000-10-20 11:22:33.123456" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2000-10-20 11:22:33.123456" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2000-10-20 11:22:33.123450" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2000-10-20 11:22:33.123456" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } bool(false) bool(false)
Output for 8.0.1 - 8.0.9
object(DateTime)#1 (3) { ["date"]=> string(26) "2000-10-20 11:22:33.123450" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2000-10-20 11:22:33.123456" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2000-10-20 11:22:33.123456" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (2000-10-20 11:22:33.12345678) at position 11 (1): The timezone could not be found in the database in /in/GhnO4:6 Stack trace: #0 /in/GhnO4(6): DateTime->__construct('2000-10-20 11:2...') #1 {main} thrown in /in/GhnO4 on line 6
Process exited with code 255.

preferences:
33.9 ms | 1142 KiB | 9 Q