3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '2018-01-11T15:36:16.000+01:00'; $date = new DateTime($string); $datetime = new DateTimeImmutable($string); $otherString = $date->format(DateTime::RFC3339_EXTENDED); $immutableString = $datetime->format(DateTime::RFC3339_EXTENDED); var_dump( $string == $otherString, $string == $immutableString, DateTime::RFC3339_EXTENDED, DateTimeImmutable::getLastErrors() );
Output for 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
bool(true) bool(true) string(15) "Y-m-d\TH:i:s.vP" bool(false)
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 bool(true) bool(true) string(15) "Y-m-d\TH:i:s.vP" bool(false)
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28
bool(true) bool(true) string(15) "Y-m-d\TH:i:s.vP" array(4) { ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(0) ["errors"]=> array(0) { } }

preferences:
184.29 ms | 403 KiB | 158 Q