note 26328 deleted from language.operators.comparison by didou
| From: | didou@php.net | Date: | Fri, 03 Oct 2003 16:50:44 +0000 |
| Subject: | note 26328 deleted from language.operators.comparison by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57770@lists.php.net to get a copy of this message | ||
Note Submitter: mail@thomas-hoerner.de
----
Be carefull using == with objects. == seems to be NOT recursive-save! You may end in an
endless-loop.
example:
class Treeobject {
var $Parent;
var $Childs;
function Treeobject(&$parent) {
$this->Parent = &$parent;
}
function MakeAChild() {
$this->Childs[] = new Treeobject($this);
}
}
Never compare different Parent->Childs[x] using == because it may result in an endless-loop.
(Other annotation to the class-system used above:
Remember possible memory because of the references. You have to handle it manually because of the
circular references)
Hope it helped (or am I wrong with my conclusion? please answer to me in this case).
Thomas Horner