3v4l.org

run code in 500+ 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); $newTextDoc = $helloTextNode->ownerDocument; echo is_null($helloTextNode->ownerDocument) ? 'Missing owner doc' : 'Has owner doc';
Output for 8.1.32 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.13, 8.3.15 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Has owner doc
Output for 8.3.14
Missing owner doc

preferences:
40.07 ms | 837 KiB | 4 Q