<?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);
Warning: Cannot compare DateInterval objects in /in/O8Okj on line 10
bool(false)
Warning: Cannot compare DateInterval objects in /in/O8Okj on line 18
bool(false)