3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dateTimeZoneTaipei = new DateTimeZone("Asia/Taipei"); $dateTimeZoneJapan = new DateTimeZone("Asia/Tokyo"); // Create two DateTime objects that will contain the same Unix timestamp, but // have different timezones attached to them. $dateTimeTaipei = new DateTime("now", $dateTimeZoneTaipei); $dateTimeJapan = new DateTime("now", $dateTimeZoneJapan); // Calculate the GMT offset for the date/time contained in the $dateTimeTaipei // object, but using the timezone rules as defined for Tokyo // ($dateTimeZoneJapan). $timeOffset = $dateTimeZoneJapan->getOffset($dateTimeTaipei); // Should show int(32400) (for dates after Sat Sep 8 01:00:00 1951 JST). var_dump($timeOffset);
Output for 5.2.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
int(32400)
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTimeZone' not found in /in/168fY on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetimezone in /in/168fY on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetimezone in /in/168fY on line 3