3v4l.org

run code in 200+ php & hhvm versions
<?php $string = '2018-01-11T15:36:16.000+01:00'; $datetime = new \DateTimeImmutable($string); var_dump( $datetime->format(\DateTime::RFC3339_EXTENDED) === $string, \DateTimeImmutable::createFromFormat(\DateTime::RFC3339_EXTENDED, $string), \DateTimeImmutable::getLastErrors() );
based on 8I4eB
Output for 7.3.0 - 7.3.1
bool(true) object(DateTimeImmutable)#2 (3) { ["date"]=> string(26) "2018-01-11 15:36:16.000000" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+01:00" } array(4) { ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(0) ["errors"]=> array(0) { } }
Output for 7.0.0 - 7.2.13
bool(true) bool(false) array(4) { ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(2) ["errors"]=> array(2) { [20]=> string(35) "The format separator does not match" [21]=> string(47) "The timezone could not be found in the database" } }
Output for hhvm-3.22.0
Fatal error: Uncaught Error: Couldn't find constant DateTime::RFC3339_EXTENDED in /in/N3UgG:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
Fatal error: Uncaught Error: Couldn't find constant DateTime::RFC3339_EXTENDED in /in/N3UgG:7 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.38
Fatal error: Undefined class constant 'RFC3339_EXTENDED' in /in/N3UgG on line 7
Process exited with code 255.