3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set("UTC"); var_dump( date_parse('0000-00-00 00:00:00') ); var_dump( strtotime('0000-00-00 00:00:00') ); var_dump( $dt = new DateTime('0000-00-00 00:00:00') ); echo $dt->format( DateTime::ISO8601 ), "\n";
Output for 5.4.30 - 5.4.45, 5.5.14 - 7.2.0
array(12) { ["year"]=> int(0) ["month"]=> int(0) ["day"]=> int(0) ["hour"]=> int(0) ["minute"]=> int(0) ["second"]=> int(0) ["fraction"]=> float(0) ["warning_count"]=> int(1) ["warnings"]=> array(1) { [20]=> string(27) "The parsed date was invalid" } ["error_count"]=> int(0) ["errors"]=> array(0) { } ["is_localtime"]=> bool(false) } int(-62169984000) object(DateTime)#1 (3) { ["date"]=> string(27) "-0001-11-30 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } -0001-11-30T00:00:00+0000
Output for 5.3.0 - 5.4.29, 5.5.0 - 5.5.13
array(12) { ["year"]=> int(0) ["month"]=> int(0) ["day"]=> int(0) ["hour"]=> int(0) ["minute"]=> int(0) ["second"]=> int(0) ["fraction"]=> float(0) ["warning_count"]=> int(1) ["warnings"]=> array(1) { [20]=> string(27) "The parsed date was invalid" } ["error_count"]=> int(0) ["errors"]=> array(0) { } ["is_localtime"]=> bool(false) } int(-62169984000) object(DateTime)#1 (3) { ["date"]=> string(20) "-0001-11-30 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } -0001-11-30T00:00:00+0000
Output for 5.2.6 - 5.2.17
array(12) { ["year"]=> int(0) ["month"]=> int(0) ["day"]=> int(0) ["hour"]=> int(0) ["minute"]=> int(0) ["second"]=> int(0) ["fraction"]=> float(0) ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(0) ["errors"]=> array(0) { } ["is_localtime"]=> bool(false) } int(-62169984000) object(DateTime)#1 (0) { } -0001-11-30T00:00:00+0000
Output for 5.2.4 - 5.2.5
array(12) { ["year"]=> int(0) ["month"]=> int(0) ["day"]=> int(0) ["hour"]=> int(0) ["minute"]=> int(0) ["second"]=> int(0) ["fraction"]=> float(0) ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(0) ["errors"]=> array(0) { } ["is_localtime"]=> bool(false) } bool(false) object(DateTime)#1 (0) { } -0001-11-30T00:00:00+0000
Output for 5.2.0 - 5.2.3
array(12) { ["year"]=> int(2000) ["month"]=> int(0) ["day"]=> int(0) ["hour"]=> int(0) ["minute"]=> int(0) ["second"]=> int(0) ["fraction"]=> float(0) ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(0) ["errors"]=> array(0) { } ["is_localtime"]=> bool(false) } int(943920000) object(DateTime)#1 (0) { } 1999-11-30T00:00:00+0000
Output for 5.1.0 - 5.1.6
Fatal error: Call to undefined function date_parse() in /in/W6qLE on line 4
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function date_default_timezone_set() in /in/W6qLE on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected ')', expecting '(' in /in/W6qLE on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected ')', expecting '(' in /in/W6qLE on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'('' in /in/W6qLE on line 7
Process exited with code 255.