Answer the question
In order to leave comments, you need to log in
Features of date comparison in php?
I know it's not a fair comparison. I would like to know why this is the result.
Why does the result show that the first date is less than the second? I understand that he most likely casts these lines to some kind of scalar type. But to which one exactly? And why?
(date('01.01.2016') < date('25.12.2015')) === true
Answer the question
In order to leave comments, you need to log in
string date ( string $format [, int $timestamp = time() ] )
$first = DateTime::createFromFormat('d.m.Y', '01.01.2016');
$second = DateTime::createFromFormat('d.m.Y', '25.12.2015');
var_dump($first < $second);
var_dump(strtotime('01.01.2016') < strtotime('25.12.2015'));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question