1--TEST-- 2DOMParentNode::prepend() 3--EXTENSIONS-- 4dom 5--FILE-- 6<?php 7declare(strict_types=1); 8 9require_once("dom_test.inc"); 10 11$dom = new DOMDocument; 12$dom->loadXML('<test><mark/><mark><nested /></mark><mark/></test>'); 13 14$element = $dom->documentElement; 15$firstMark = $element->childNodes[0]; 16$element->prepend( 17 $dom->createElement('element', 'content'), 18 'content' 19); 20 21var_dump($element->childElementCount); 22print_node_list_compact($element->childNodes); 23 24$element = $dom->documentElement; 25$element->prepend( 26 $dom->createElement('element', 'content'), 27 'content' 28); 29var_dump($element->childElementCount); 30 31$firstMark->prepend('content'); 32print_node_list_compact($firstMark->childNodes); 33?> 34--EXPECT-- 35int(4) 36<element> 37 content 38</element> 39content 40<mark> 41</mark> 42<mark> 43 <nested> 44 </nested> 45</mark> 46<mark> 47</mark> 48int(5) 49content 50