3v4l.org

run code in 300+ PHP versions simultaneously
<?php $timestamp = time(); echo $timestamp, PHP_EOL; $dateTime = new DateTime('@' . $timestamp); echo $dateTime->getTimestamp(), PHP_EOL, $dateTime->format('H:i:sP'), PHP_EOL; $dateTime = new DateTime('@' . $timestamp, new DateTimeZone()); echo $dateTime->getTimestamp(), PHP_EOL, $dateTime->format('H:i:sP'), PHP_EOL;
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1
1452860414 1452860414 12:20:14+00:00 Fatal error: Uncaught ArgumentCountError: DateTimeZone::__construct() expects exactly 1 parameter, 0 given in /in/4GQGq:10 Stack trace: #0 /in/4GQGq(10): DateTimeZone->__construct() #1 {main} thrown in /in/4GQGq on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.33
1452860414 1452860414 12:20:14+00:00 Fatal error: Uncaught TypeError: DateTimeZone::__construct() expects exactly 1 parameter, 0 given in /in/4GQGq:10 Stack trace: #0 /in/4GQGq(10): DateTimeZone->__construct() #1 {main} thrown in /in/4GQGq on line 10
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
1452860414 1452860414 12:20:14+00:00 Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct() expects exactly 1 parameter, 0 given' in /in/4GQGq:10 Stack trace: #0 /in/4GQGq(10): DateTimeZone->__construct() #1 {main} thrown in /in/4GQGq on line 10
Process exited with code 255.

preferences:
150.16 ms | 402 KiB | 196 Q