function changeParent($to, &$index = null) { #php5e if ($this->parent !== null) { $this->parent->deleteChild($this, true); } $this->parent = $to; if ($index !== false) { $new_index = $this->index(); if (!(is_int($new_index) && $new_index >= 0)) { $this->parent->addChild($this, $index); } } }