title: Evaluate if result of DOMXpath->query returns match
body: <p>How can I evaluate if DOMTXpath->query actually returns data. Right now I am doing ($xml is a DOMXpath object):</p>
  
  <pre><code>foreach($xml-&gt;query($xpath) as $node)
  {
    echo $node-&gt;textContent;
  }
  </code></pre>
  
  <p>But if I my $xpath doesn't result in a node it just doesn't output any data. I tried something like:</p>
  
  <pre><code>if ($xml-&gt;query($xpath))
  {
  echo "found";
  }else{
  echo "not found";
  }
  </code></pre>
  
  <p>but that doesn't seem to work. How can I test if my query is actually returning a matching node (actually an attribute in this case)?</p>