/** * Clones an object of this class. Ensures that references will be cloned, too. */ public function __clone() { parent::__clone(); // clone array-types if (is_array($this->_value)) { // note that this does handle multi-dimensional arrays! foreach ($this->_value as $k => $v) { $this->_value[$k] = clone $v; } } }
public function __clone() { parent::__clone(); foreach ($this->types as $k => $t) { $this->types[$k] = clone $t; } }