3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $tz = new DateTimeZone("Pacific/Chatham"); $utcNow = new DateTimeImmutable("now", new DateTimeZone("UTC")); $offsetMins = $tz->getOffset($utcNow); $offsetHours = $offset/3600; $hours = floor($offsetHours); $mins = 60 * ($offsetHours - $hours); var_dump( $offsetMins, $offsetHours, $hours, $mins );
based on unXAd
Output for 5.6.3 - 5.6.30, 7.0.0 - 7.2.6
Notice: Undefined variable: offset in /in/s98NT on line 6 int(45900) int(0) float(0) float(0)
Output for hhvm-3.15.4
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, DateTimeImmutable given in /in/s98NT on line 5 Notice: Undefined variable: offset in /in/s98NT on line 6 bool(false) int(0) float(0) float(0)
Output for 5.6.0 - 5.6.2
Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, object given in /in/s98NT on line 5 Notice: Undefined variable: offset in /in/s98NT on line 6 bool(false) int(0) float(0) float(0)