Skip to content

Instantly share code, notes, and snippets.

@rgranadino
Created July 12, 2012 20:29
Show Gist options
  • Save rgranadino/3100752 to your computer and use it in GitHub Desktop.
Save rgranadino/3100752 to your computer and use it in GitHub Desktop.
php object comparison recursion example
class Foo {
public $x = null;
}
$a = new Foo();
$b = new Foo();
$c = new Foo();
$d = new Foo();
$a->x = $c;
$b->x = $d;
$c->x = 1;
var_dump($a == $b);//bool(false)
$d->x = 1;
var_dump($a == $b);//bool(true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment