3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dt = new \DateTime('2018-04-01 03:10:00', new \DateTimeZone('Pacific/Auckland')); $dt2 = clone $dt; $dt2->sub(new \DateInterval('PT2H')); var_dump($dt > $dt2, $dt->format(\DateTime::RFC3339), $dt2->format(\DateTime::RFC3339), $dt->diff($dt2)->format('%h'));
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.30, 8.0.0 - 8.0.22, 8.1.0 - 8.1.9
bool(true) string(25) "2018-04-01T03:10:00+12:00" string(25) "2018-04-01T02:10:00+13:00" string(1) "1"

preferences:
51.54 ms | 410 KiB | 5 Q