title: Debug a DOMDocument Object in PHP
body: <p>I'm trying to debug a large and complex DOMDocument object in php.  Ideally it'd be nice if I could get DOMDocument to output in a array-like format.  </p>
  
  <p>DoMDocument:</p>
  
  <pre>$dom = new DOMDocument();
  $dom->loadHTML("&lt;html>&lt;body>&lt;p>Hello World&lt;/p>&lt;/body>&lt;/html>");
  var_dump($dom); //or something equivalent</pre>
  
  <p>This outputs </p>
  
  <pre>DOMDocument Object ( ) </pre>
  
  <p>whereas I'd like it to output</p>
  
  <pre>DOMDocument:
  html
  =>body
  ==>p
  ===>Hello World</pre>
  
  <p>Or something like that.  Why is there no handy debug or output for this?!?</p>