16

I have this code:

$i1 = DateInterval::createFromDateString('10 minutes');
$i2 = DateInterval::createFromDateString('30 minutes');
var_dump($i1 > $i2);
var_dump($i1 > $i2);
var_dump($i1);
var_dump($i1 > $i2);
var_dump($i1 > $i2);

And this output:

bool(false)
bool(false)
object(DateInterval)#3 (8) {
  ...
}
bool(true)
bool(true)

Is it a php bug? Help me to understand the reason for this behavior

  • 5
    Related: http://stackoverflow.com/questions/9547855/are-php-dateinterval-comparable-like-datetime?rq=1. Notably the part in the answer where it says "doing a var dump changes the outcome". – rink.attendant.6 Oct 08 '14 at 14:27

0 Answers0