When i add a node to a tree, i store its parent address (i thought so) in it:
-- Client --
$parent = new Node();
$child = new Node();
$parent->add($child)
-- Class Node --
function add($child) {
$this->setParent(&$this);
$this->children[] = $child;
}
function setParent($ref_parent) {
$this->ref_parent = $ref_parent;
}
But when i try to echo $child->ref_parent, it fails on "Catchable fatal error: Object of class Node could not be converted to string...", i use & cos i don't want to store parent object in its child, but seems don't work, any idea?