3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('UTC'); $date1 = new DateTime('2015-01-01T12:00:00'); $date2 = new DateTime('2015-01-01T12:01:00'); var_dump($date1 < $date2); $date1->setTimezone(new DateTimeZone('UTC')); $date2->setTimezone(new DateTimeZone('EST')); var_dump($date1 < $date2); $date1->getTimestamp(); $date2->getTimestamp(); var_dump($date1 < $date2);
Output for 5.5.0 - 5.5.9, 7.0.17 - 7.0.32, 7.1.3 - 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.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
bool(true) bool(true) bool(true)
Output for 5.5.10 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.16, 7.1.0 - 7.1.2
bool(true) bool(false) bool(true)

preferences:
85.79 ms | 407 KiB | 5 Q