--TEST-- DOMNode::replaceWith() --SKIPIF-- --FILE-- loadXML('firstsecond'); $element = $dom->documentElement->firstChild; $element->replaceWith( $dom->createElement('element', 'content'), 'content' ); print_node_list_compact($dom->documentElement->childNodes); ?> --EXPECT-- content content second