3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Create two identical DateTime objects $a = new DateTime("2015-02-01 00:00:00", new DateTimeZone("PST")); $b = clone $a; // They should be equal (and they are) compare($a, $b); // Now change the timezone to EST. $b->setTimezone(new DateTimeZone("EST")); //The actual timestamp should not change (it does not in PHP 5.4) so $a should still be equal to $b, but it will say $a > $b. compare($a, $b); function compare($a, $b) { var_dump($a); var_dump($b); echo ($a > $b ? '$a > $b' : ($a < $b ? '$a < $b' : ($a == $b ? '$a == $b' : 'undefined'))) . "\n"; }

preferences:
28.34 ms | 402 KiB | 5 Q