title: Why am I getting (object value omitted) when trying to find attribute of a node?
body: <p>I have an HTML file and am trying to use DOM to find the <code>id</code> attribute of all <code>&lt;h2&gt;</code> elements:</p>
  
  <pre><code>$html = new DOMDocument;
  $html-&gt;loadHTML($file);
  $headings = $html-&gt;getElementsByTagName('h2');
  </code></pre>
  
  <p>Which as expected returns a <code>DOMNodeList</code> with a count equal to the number of headings in my document.  When I iterate through this and try to explore the data returned through <code>var_dump</code> or <code>print_r</code> I get a (object value omitted) error for the list of attributes however:</p>
  
  <pre><code>object(DOMElement)#10 (18) {
    ["tagName"]=&amp;gt;
    string(2) "h2"
    ["schemaTypeInfo"]=&amp;gt;
    NULL
    ["nodeName"]=&amp;gt;
    string(2) "h2"
    ["nodeValue"]=&amp;gt;
    string(10) "What next?"
    ["nodeType"]=&amp;gt;
    int(1)
    ["parentNode"]=&amp;gt;
    string(22) "(object value omitted)"
    ["childNodes"]=&amp;gt;
    string(22) "(object value omitted)"
    ["firstChild"]=&amp;gt;
    string(22) "(object value omitted)"
    ["lastChild"]=&amp;gt;
    string(22) "(object value omitted)"
    ["previousSibling"]=&amp;gt;
    string(22) "(object value omitted)"
    ["nextSibling"]=&amp;gt;
    string(22) "(object value omitted)"
    ["attributes"]=&amp;gt;
    string(22) "(object value omitted)"
    ["ownerDocument"]=&amp;gt;
    string(22) "(object value omitted)"
    ["namespaceURI"]=&amp;gt;
    NULL
    ["prefix"]=&amp;gt;
    string(0) ""
    ["localName"]=&amp;gt;
    string(2) "h2"
    ["baseURI"]=&amp;gt;
    NULL
    ["textContent"]=&amp;gt;
    string(10) "What next?"
  }
  </code></pre>
  
  <p>Why is this and why can't I see the number of attributes, or why isn't a <code>DOMNamedNodeMap</code> being returned as <a href="http://php.net/manual/en/class.domnode.php#domnode.props.attributes" rel="nofollow noreferrer" title="the documentation">the documentation</a> says it should be?  </p>
  
  <p>I've tried using an xPath rather than the <code>getElementsByTagName</code> function, but have the same problem.</p>
  
  <p>How do I retrieve the attributes? I can't see a method to do this?</p>