This function behaves differently depending on PHP version:
- It forgets attributes of the new node in PHP 5.2,
- but copies them in PHP 5.3.
(at least when looking at the SimpleXMLElement mirror of the DOM being changed in DOM (by lack of equivalent methods in SimpleXMLElement).
Annoying different behavior / bug, but good to know. Would be good to update the doc about what the wanted behavor is
In both versions, children nodes are not coming together with the new node and need to be added one by one recursively. Just good to know too.