Created
July 12, 2012 20:29
-
-
Save rgranadino/3100752 to your computer and use it in GitHub Desktop.
php object comparison recursion example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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