note 26328 added to language.operators.comparison
| From: | mail at thomas-hoerner dot de | Date: | Sat, 26 Oct 2002 17:47:22 +0000 |
| Subject: | note 26328 added to language.operators.comparison | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38593@lists.php.net to get a copy of this message | ||
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
--
http://www.php.net/manual/en/language.operators.comparison.php
http://master.php.net/manage/user-notes.php?action=edit+26328
http://master.php.net/manage/user-notes.php?action=delete+26328
http://master.php.net/manage/user-notes.php?action=reject+26328