3v4l.org

run code in 300+ PHP versions simultaneously
<?php $value = new DateTime(null, new DateTimeZone('Australia/Sydney')); var_dump(new DateTime($value->format('Y-m-d H:i:s T')));
Output for 8.1.0 - 8.1.24, 8.2.0 - 8.2.11
Deprecated: DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in /in/2i816 on line 3 object(DateTime)#2 (3) { ["date"]=> string(26) "2015-10-22 03:47:44.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(4) "AEDT" }
Output for 5.5.22 - 5.5.38, 5.6.6 - 5.6.40, 7.0.0 - 7.0.15, 7.0.17 - 7.0.33, 7.1.0 - 7.1.2, 7.1.4 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0, 7.3.2 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-10-22 03:47:44.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(4) "AEDT" }
Output for 7.0.16, 7.1.3, 7.3.1
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-10-22 03:47:45.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(4) "AEDT" }
Output for 5.4.33 - 5.4.38, 5.4.40 - 5.4.45, 5.5.17 - 5.5.21, 5.6.0 - 5.6.5
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (2015-10-22 03:47:44 AEDT) at position 20 (A): The timezone could not be found in the database' in /in/2i816:4 Stack trace: #0 /in/2i816(4): DateTime->__construct('2015-10-22 03:4...') #1 {main} thrown in /in/2i816 on line 4
Process exited with code 255.
Output for 5.4.30 - 5.4.32, 5.5.14 - 5.5.16
object(DateTime)#2 (3) { ["date"]=> string(26) "2015-10-22 03:47:44.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "EST" }
Output for 5.4.0 - 5.4.29, 5.5.0 - 5.5.13
object(DateTime)#2 (3) { ["date"]=> string(19) "2015-10-22 03:47:44" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "EST" }
Output for 5.4.39
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (2015-10-22 03:47:45 AEDT) at position 20 (A): The timezone could not be found in the database' in /in/2i816:4 Stack trace: #0 /in/2i816(4): DateTime->__construct('2015-10-22 03:4...') #1 {main} thrown in /in/2i816 on line 4
Process exited with code 255.

preferences:
44.27 ms | 414 KiB | 5 Q