3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Get an interval between 1st January and 14th January $diff1 = (new DateTimeImmutable('2019-01-01'))->diff(new DateTimeImmutable('2019-01-14')); // Get another interval, but this time an extra day on the end $diff2 = (new DateTimeImmutable('2019-01-01'))->diff(new DateTimeImmutable('2019-01-15')); // Check if the first interval is shorter than the second var_dump($diff1 < $diff2); // Oh, that's weird... // Let's peek inside the two intervals var_export($diff1, true); var_export($diff2, true); // Now let's check again var_dump($diff1 < $diff2);

preferences:
27.24 ms | 405 KiB | 5 Q