What will be returned by this code?

Technology CommunityCategory: PHPWhat will be returned by this code?
VietMX Staff asked 4 years ago
Problem

Consider the code:

$a = new stdClass();
$a->foo = "bar";
$b = clone $a;
var_dump($a === $b);

What will be echoed to the console?

Two instances of the same class with equivalent members do NOT match the === operator. So the answer is:

bool(false)