3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tz = new DateTimeZone('-09:00'); $dbTz = new DateTimeZone('+00:00'); $date = new DateTimeImmutable('2015-09-01+00:00', $tz); var_dump($date->getOffset()); $date = $date->setTimezone($tz); var_dump($date->getOffset()); $date = $date->setTimezone($dbTz); var_dump($date->getOffset());
Output for 5.5.10 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
int(0) int(-32400) int(0)
Output for 5.5.0 - 5.5.9
Fatal error: Uncaught exception 'Exception' with message 'DateTimeZone::__construct(): Unknown or bad timezone (-09:00)' in /in/JtAdV:3 Stack trace: #0 /in/JtAdV(3): DateTimeZone->__construct('-09:00') #1 {main} thrown in /in/JtAdV on line 3
Process exited with code 255.

preferences:
255.22 ms | 402 KiB | 322 Q