public function _clone() { $newStack = array(); //pr(array('copy... ', $this->whois())); //$this->dumpHistory('copy'); $this->elementsBackup = $this->elements; foreach ($this->elements as $node) { $newStack[] = $node->cloneNode(true); } $this->elements = $newStack; return $this->newInstance(); }