1--TEST-- 2DOMNode::replaceWith() 3--SKIPIF-- 4<?php require_once('skipif.inc'); ?> 5--FILE-- 6<?php 7require_once("dom_test.inc"); 8 9$dom = new DOMDocument; 10$dom->loadXML('<test><mark>first</mark><mark>second</mark></test>'); 11 12$element = $dom->documentElement->firstChild; 13$element->replaceWith( 14 $dom->createElement('element', 'content'), 15 'content' 16); 17 18print_node_list_compact($dom->documentElement->childNodes); 19?> 20--EXPECT-- 21<element> 22 content 23</element> 24content 25<mark> 26 second 27</mark> 28