3v4l.org

run code in 300+ PHP versions simultaneously
<?php $theTime = time(); // specific date/time we're checking, in epoch seconds. $tz = new DateTimeZone('America/Los_Angeles'); $transition = $tz->getTransitions($theTime, $theTime); // only one array should be returned into $transition. Now get the data: $offset = $transition[0]['offset']; $abbr = $transition[0]['abbr']; echo $offset . PHP_EOL; echo $abbr;
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.6 - 7.2.25, 7.3.0 - 7.3.12, 7.4.0
-28800 PST
Output for 5.2.0 - 5.2.17
Warning: DateTimeZone::getTransitions() expects exactly 0 parameters, 2 given in /in/mHfcf on line 5
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Class 'DateTimeZone' not found in /in/mHfcf on line 4
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: datetimezone in /in/mHfcf on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetimezone in /in/mHfcf on line 4

preferences:
153.73 ms | 401 KiB | 248 Q