3v4l.org

run code in 300+ PHP versions simultaneously
<?php $winter = new DateTime('2010-12-21', new DateTimeZone('Europe/Zurich')); $summer = new DateTime('2008-06-21', new DateTimeZone('Europe/Zurich')); $summer2 = new DateTime('2008-06-21T12:14:12Z', new DateTimeZone('Europe/Zurich')); echo $winter->getOffset() . "\n"; echo $summer->getOffset() . "\n"; echo $summer2->getOffset() . "\n"; echo $summer2->format('Ymd H:i');
Output for 5.2.6 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.18, 5.5.20 - 5.5.33, 5.5.38, 5.6.0 - 5.6.5, 5.6.7 - 5.6.8, 5.6.10, 5.6.12 - 5.6.19, 5.6.21 - 5.6.23, 5.6.25 - 5.6.30, 5.6.34 - 5.6.40, 7.0.0 - 7.0.3, 7.0.6, 7.0.9 - 7.0.18, 7.0.20 - 7.0.24, 7.0.32 - 7.0.33, 7.1.0 - 7.1.6, 7.1.8 - 7.1.9, 7.1.11 - 7.1.17, 7.1.19 - 7.1.33, 7.2.9 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1, 8.2.16 - 8.2.17, 8.3.3 - 8.3.4
3600 7200 0 20080621 12:14
Output for 5.5.19, 5.5.34 - 5.5.37, 5.6.6, 5.6.9, 5.6.11, 5.6.20, 5.6.24, 5.6.31 - 5.6.33, 7.0.4 - 7.0.5, 7.0.7 - 7.0.8, 7.0.19, 7.0.25 - 7.0.31, 7.1.7, 7.1.10, 7.1.18, 7.2.0 - 7.2.8

Process exited with code 137.
Output for 5.2.0 - 5.2.5
3600 7200 7200 20080621 12:14
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/rJrfs on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/rJrfs on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/rJrfs on line 3

preferences:
224.87 ms | 401 KiB | 329 Q