3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<CDATA <p>World!</p> CDATA; $doc = new DOMDocument(); $doc->loadHTML($html); $children = $doc->childNodes; $pTag = $doc->getElementsByTagName('p')[0]; $worldTextNode = $pTag->childNodes[0]; $helloTextNode = new DOMText('Hello '); $worldTextNode->parentNode->insertBefore($helloTextNode, $worldTextNode); echo is_null($helloTextNode->ownerDocument) ? 'Missing owner doc' : 'Has owner doc';
Output for 8.1.32, 8.2.0 - 8.2.29, 8.3.0 - 8.3.13, 8.3.15 - 8.3.26, 8.4.1 - 8.4.13
Has owner doc
Output for 8.3.14
Missing owner doc

preferences:
71.44 ms | 406 KiB | 5 Q