note 63714 deleted from language.oop.object-comparison by danbrown
| From: | danbrown@php.net | Date: | Sat, 07 Nov 2009 19:01:44 +0000 |
| Subject: | note 63714 deleted from language.oop.object-comparison by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-162547@lists.php.net to get a copy of this message | ||
Note Submitter: magicturkey at gmail dot com
----
If youre just checking to see if the variables both reference the same object, instead of having a
variable set up beforehand you could do away with the GLOBALS and have something like..
e.g.
<?php
class Foo {
var $serial;
function Foo() {
// Rest of constructor...
}
// Rest of class definition...
}
$baz->serial = -1;
$bar->serial = time();
if($bar->serial == $baz->serial) {
echo "Same";
}
?>