3v4l.org

run code in 300+ PHP versions simultaneously
<?php $datestring = '2017-06-03T00:08:10.881UTCXX'; if ($date = date_create_from_format(DateTime::RFC3339_EXTENDED, $datestring)) { print_r($date); } else { print_r(date_get_last_errors()); } if ($date = date_create($datestring)) { print_r($date); } else { print_r(date_get_last_errors()); } if ($date = DateTime::createFromFormat(DateTime::RFC3339_EXTENDED, $datestring)) { print_r($date); } else { print_r(DateTime::getLastErrors()); } if ($date = new DateTime($datestring)) { print_r($date); } else { print_r(DateTime::getLastErrors()); } if ($date = DateTimeImmutable::createFromFormat(DateTimeImmutable::RFC3339_EXTENDED, $datestring)) { print_r($date); } else { print_r(DateTimeImmutable::getLastErrors()); } if ($date = new DateTimeImmutable($datestring)) { print_r($date); } else { print_r(DateTimeImmutable::getLastErrors()); }
Output for 8.3.0 - 8.3.4, 8.3.6
Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [23] => The timezone could not be found in the database ) ) Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [23] => The timezone could not be found in the database ) ) Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [23] => The timezone could not be found in the database ) ) Fatal error: Uncaught DateMalformedStringException: Failed to parse time string (2017-06-03T00:08:10.881UTCXX) at position 23 (U): The timezone could not be found in the database in /in/sGC86:23 Stack trace: #0 /in/sGC86(23): DateTime->__construct('2017-06-03T00:0...') #1 {main} thrown in /in/sGC86 on line 23
Process exited with code 255.
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 Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [23] => The timezone could not be found in the database ) ) Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [23] => The timezone could not be found in the database ) ) Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [23] => The timezone could not be found in the database ) ) Fatal error: Uncaught DateMalformedStringException: Failed to parse time string (2017-06-03T00:08:10.881UTCXX) at position 23 (U): The timezone could not be found in the database in /in/sGC86:23 Stack trace: #0 /in/sGC86(23): DateTime->__construct('2017-06-03T00:0...') #1 {main} thrown in /in/sGC86 on line 23
Process exited with code 255.
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [23] => The timezone could not be found in the database ) ) Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [23] => The timezone could not be found in the database ) ) Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [23] => The timezone could not be found in the database ) ) Fatal error: Uncaught Exception: Failed to parse time string (2017-06-03T00:08:10.881UTCXX) at position 23 (U): The timezone could not be found in the database in /in/sGC86:23 Stack trace: #0 /in/sGC86(23): DateTime->__construct('2017-06-03T00:0...') #1 {main} thrown in /in/sGC86 on line 23
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [23] => The timezone could not be found in the database ) ) Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [23] => The timezone could not be found in the database ) ) Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [23] => The timezone could not be found in the database ) ) Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (2017-06-03T00:08:10.881UTCXX) at position 23 (U): The timezone could not be found in the database in /in/sGC86:23 Stack trace: #0 /in/sGC86(23): DateTime->__construct('2017-06-03T00:0...') #1 {main} thrown in /in/sGC86 on line 23
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 2 [errors] => Array ( [20] => The format separator does not match [21] => The timezone could not be found in the database ) ) Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 1 [errors] => Array ( [23] => The timezone could not be found in the database ) ) Array ( [warning_count] => 0 [warnings] => Array ( ) [error_count] => 2 [errors] => Array ( [20] => The format separator does not match [21] => The timezone could not be found in the database ) ) Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (2017-06-03T00:08:10.881UTCXX) at position 23 (U): The timezone could not be found in the database in /in/sGC86:23 Stack trace: #0 /in/sGC86(23): DateTime->__construct('2017-06-03T00:0...') #1 {main} thrown in /in/sGC86 on line 23
Process exited with code 255.
Output for 5.6.0 - 5.6.40
Fatal error: Undefined class constant 'RFC3339_EXTENDED' in /in/sGC86 on line 5
Process exited with code 255.

preferences:
223.48 ms | 401 KiB | 291 Q