- var_dump: documentation ( source)
<?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;
}