title: Get all elements by class name using DOMDocument
body: <p>This question seems to have been answered numerous times but i still cant seem to put the pieces together.</p>
  
  <p>I would like to get node value of every class by name. for example </p>
  
  <pre><code>&lt;td class="thename"&gt;&lt;strong&gt;32&lt;/strong&gt;&lt;/td&gt;
  &lt;td class="thename"&gt;&lt;strong&gt;12&lt;/strong&gt;&lt;/td&gt;
  </code></pre>
  
  <p>i would like to grab the 32 and the 12. I assume this requires for sort of for loop but not sure exactly how to go about implementing it. Here's what i have so far</p>
  
  <pre><code>$domain = "http://domain.com";
  $dom = new DOMDocument();
  
  $dom-&gt;loadHTMLFile($domain);
  $xpath = new DomXpath($dom);
  $div = $xpath-&gt;query('//*[@class="thename"]')-&gt;item(0);
  $stuff = $div -&gt;textContent;
  
  echo($stuff);
  </code></pre>