3v4l.org

run code in 300+ PHP versions simultaneously
<?php $d = (new ReflectionClass(DateTime::class))->newInstanceWithoutConstructor(); $d->date = '1990-01-17 10:28:07'; $d->timezone_type = 3; $d->timezone = 'US/Pacific'; $d = unserialize(serialize($d)); var_dump($d->format('c'));
Output for 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Deprecated: Creation of dynamic property DateTime::$date is deprecated in /in/DROXa on line 5 Deprecated: Creation of dynamic property DateTime::$timezone_type is deprecated in /in/DROXa on line 6 Deprecated: Creation of dynamic property DateTime::$timezone is deprecated in /in/DROXa on line 7 Fatal error: Uncaught DateObjectError: Object of type DateTime has not been correctly initialized by calling parent::__construct() in its constructor in /in/DROXa:9 Stack trace: #0 [internal function]: DateTime->__serialize() #1 /in/DROXa(9): serialize(Object(DateTime)) #2 {main} thrown in /in/DROXa on line 9
Process exited with code 255.
Output for 8.2.0 - 8.2.29
Deprecated: Creation of dynamic property DateTime::$date is deprecated in /in/DROXa on line 5 Deprecated: Creation of dynamic property DateTime::$timezone_type is deprecated in /in/DROXa on line 6 Deprecated: Creation of dynamic property DateTime::$timezone is deprecated in /in/DROXa on line 7 Fatal error: Uncaught Error: The DateTime object has not been correctly initialized by its constructor in /in/DROXa:9 Stack trace: #0 [internal function]: DateTime->__serialize() #1 /in/DROXa(9): serialize(Object(DateTime)) #2 {main} thrown in /in/DROXa on line 9
Process exited with code 255.
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.33
string(25) "1990-01-17T10:28:07-08:00"

preferences:
48.52 ms | 410 KiB | 5 Q