3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $h = '2015-07-20 20:00:00'; $defaultTimeZone = new DateTimeImmutable('now', 'EET'); $defaultTimeZone = $defaultTimeZone->getTimezone(); $df = new DateTimeImmutable($h, new DateTimeZone('UTC')); $df = $df->setTimezone($defaultTimeZone); $eh = (int) $df->format('H'); var_dump($df);
based on gjkm3
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: DateTimeImmutable::__construct() expects parameter 2 to be DateTimeZone, string given in /in/Kfab4:5 Stack trace: #0 /in/Kfab4(5): DateTimeImmutable->__construct('now', 'EET') #1 {main} thrown in /in/Kfab4 on line 5
Process exited with code 255.
Output for 5.5.24 - 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'DateTimeImmutable::__construct() expects parameter 2 to be DateTimeZone, string given' in /in/Kfab4:5 Stack trace: #0 /in/Kfab4(5): DateTimeImmutable->__construct('now', 'EET') #1 {main} thrown in /in/Kfab4 on line 5
Process exited with code 255.
Output for 5.3.18 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/Kfab4 on line 5
Process exited with code 255.