3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body><div id="div1"><div id="div2">222</div><div id="div3">333</div></div></body></html>'; $doc = new DOMDocument; libxml_use_internal_errors(true); $doc->loadHTML($html); $div1=$doc->getElementById('div1'); $div2=$doc->getElementById('div2'); $div3=$doc->getElementById('div3'); print_r($div2); print_r($div3); $div1->nodeValue=''; $div1->appendChild($doc->createTextNode(html_entity_decode('111'))); print_r(array($div2,$div2->parentNode)); print_r(array($div3,$div3->parentNode)); $div3->parentNode->removeChild($div3); echo $doc->saveHTML();
Output for git.master, git.master_jit, rfc.property-hooks
DOMElement Object ( [schemaTypeInfo] => [tagName] => div [firstElementChild] => [lastElementChild] => [childElementCount] => 0 [previousElementSibling] => [nextElementSibling] => (object value omitted) [nodeName] => div [nodeValue] => 222 [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => div [baseURI] => [textContent] => 222 ) DOMElement Object ( [schemaTypeInfo] => [tagName] => div [firstElementChild] => [lastElementChild] => [childElementCount] => 0 [previousElementSibling] => (object value omitted) [nextElementSibling] => [nodeName] => div [nodeValue] => 333 [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted) [nextSibling] => [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => div [baseURI] => [textContent] => 333 ) Array ( [0] => DOMElement Object ( [schemaTypeInfo] => [tagName] => div [firstElementChild] => [lastElementChild] => [childElementCount] => 0 [previousElementSibling] => [nextElementSibling] => [nodeName] => div [nodeValue] => 222 [nodeType] => 1 [parentNode] => [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [nextSibling] => [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => div [baseURI] => [textContent] => 222 ) [1] => ) Fatal error: Uncaught Error: Couldn't fetch DOMElement. Node no longer exists in /in/IpKCv:17 Stack trace: #0 {main} thrown in /in/IpKCv on line 17
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
56.31 ms | 404 KiB | 8 Q