diff --git a/reference/dom/domdocument/registernodeclass.xml b/reference/dom/domdocument/registernodeclass.xml index 7dd5b5e747..301cb90a8b 100644 --- a/reference/dom/domdocument/registernodeclass.xml +++ b/reference/dom/domdocument/registernodeclass.xml @@ -174,6 +174,46 @@ var_dump(get_class($child->ownerDocument)); + + + + + + Custom objects are transient + + + Objects of the registered node classes are transient, i.e. they are + destroyed when they are no longer referenced from PHP code, and recreated + when being retrieved again. That implies that custom property values will be + lost after recreation. + + + +registerNodeClass('DOMElement', 'MyDOMElement'); + +$node = $doc->createElement('a'); +$node->myProp = 'modified value'; +$doc->appendChild($node); + +echo $doc->childNodes[0]->myProp, PHP_EOL; +unset($node); +echo $doc->childNodes[0]->myProp, PHP_EOL; +?>]]> + + &example.outputs; + +