title: Ignore comment node in SimpleXML
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3328631/find-and-edit-comment-element-of-html-with-php">find and edit comment element of html with php</a>  </p>
  </blockquote>
  
  
  
  <p>I have a comment in my XML file. If I load it with SimpleXML and then var_dump the node (<code>var_dump($xml-&gt;node-&gt;comment);</code>), it looks like this.</p>
  
  <pre><code>["comment"]=&gt;
    object(SimpleXMLElement)#54 (0) {
  }
  </code></pre>
  
  <p>The corresponding XML would look like this.</p>
  
  <pre><code>&lt;root&gt;
    &lt;node&gt;
      &lt;!-- some comment --&gt;
    &lt;/node&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>If I want to dynamically parse this, how can I detect if this SimpleXMLElement is in fact a comment? Preferably without checking if the key is <code>comment</code>.</p>
  
  <p>Thanks.</p>
  
  <p><strong>Update:</strong> I don't want to read the comment, I want to ignore it. Realized this was unclear.</p>