3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { global $d; $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; }

preferences:
54.46 ms | 402 KiB | 5 Q