$d = new \DateTimeImmutable('2018-01-01');
$e = new \DateTimeImmutable('2018-01-01');
var_dump($d);
var_dump($e);
the output is
object(DateTimeImmutable)[1]
public 'date' => string '2018-01-01 00:00:00' (length=19)
public 'timezone_type' => int 3
public 'timezone' => string 'Europe/Paris' (length=12)
object(DateTimeImmutable)[2]
public 'date' => string '2018-01-01 00:00:00' (length=19)
public 'timezone_type' => int 3
public 'timezone' => string 'Europe/Paris' (length=12)
As per PHP manual: they deals with object as a different object or instance, when you compare two objects they deals 2 objects as a different objects
when you used ===
to compare the object or instance( Two instances of the same class) then they deals these objects as a different objects and the result is false