The cloneNode()
method creates a duplicate of the target node.
If the deep
parameter is set to true
, the method will clone the node along with all of its child nodes. Otherwise, only the node itself is cloned, without its children.
The cloned node is a new instance and will not be have a parent node unless explicitly appended.
Description
public AbstractNode::cloneNode(bool $deep): static
Parameters
deep
Whether to clone the node's descendants.
true
to clone recursivelyfalse
to clone only the node itself.
Return Value
The new cloned node.
Exceptions
None