3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump(new DateTime('2015-12-27 18:54:26')); var_dump(new DateTime('2015-12-27 18:54')); var_dump(new DateTime('2015-12-27')); var_dump(new DateTime('aardbei'));
based on 8fktl
Output for 7.0.0 - 7.2.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-27 18:54:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-27 18:54:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-27 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (aardbei) at position 0 (a): The timezone could not be found in the database in /in/oAdjR:6 Stack trace: #0 /in/oAdjR(6): DateTime->__construct('aardbei') #1 {main} thrown in /in/oAdjR on line 6
Process exited with code 255.
Output for 5.4.30 - 5.6.28
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-27 18:54:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-27 18:54:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(26) "2015-12-27 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (aardbei) at position 0 (a): The timezone could not be found in the database' in /in/oAdjR:6 Stack trace: #0 /in/oAdjR(6): DateTime->__construct('aardbei') #1 {main} thrown in /in/oAdjR on line 6
Process exited with code 255.
Output for 5.3.21 - 5.4.29
object(DateTime)#1 (3) { ["date"]=> string(19) "2015-12-27 18:54:26" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(19) "2015-12-27 18:54:00" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#1 (3) { ["date"]=> string(19) "2015-12-27 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (aardbei) at position 0 (a): The timezone could not be found in the database' in /in/oAdjR:6 Stack trace: #0 /in/oAdjR(6): DateTime->__construct('aardbei') #1 {main} thrown in /in/oAdjR on line 6
Process exited with code 255.