3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function foo() { $d = new DOMDocument; $c = $d->createElement('foo', 'bar'); $g = $d->createElement('fiz', 'buz'); $h = $d->createElement('red', 'xen'); $c->appendChild($g); $g->appendChild($h); return $h; } $x = foo(); while ($x) { var_dump($x->nodeValue); $x = $x->parentNode; }
Output for 5.2.6 - 7.2.0
Warning: Couldn't fetch DOMElement. Node no longer exists in /in/bFpXs on line 17 Notice: Undefined property: DOMElement::$nodeValue in /in/bFpXs on line 17 NULL Warning: Couldn't fetch DOMElement. Node no longer exists in /in/bFpXs on line 18 Notice: Undefined property: DOMElement::$parentNode in /in/bFpXs on line 18
Output for 5.1.3 - 5.2.5
Warning: Couldn't fetch DOMElement. Node no longer exists in /in/bFpXs on line 17 Notice: Undefined property: DOMElement::$nodeValue in /in/bFpXs on line 17 NULL Warning: Couldn't fetch DOMElement. Node no longer exists in /in/bFpXs on line 18 Notice: Undefined property: DOMElement::$parentNode in /in/bFpXs on line 18
Output for 5.0.0 - 5.1.2
Notice: Undefined property: DOMElement::$nodeValue in /in/bFpXs on line 17 NULL Notice: Undefined property: DOMElement::$parentNode in /in/bFpXs on line 18
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/bFpXs on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/bFpXs on line 4