title: Simple HTML DOM, how to echo only the text from anchor text
body: <p>summary of my code:</p>
  
  <pre><code>foreach($html-&gt;find('a') as $element) {
  </code></pre>
  
  <p>..
  I use for inner text this:</p>
  
  <pre><code>$element-&gt;innertext
  </code></pre>
  
  <p>It is any chance to echo only the text from anchor text unsing Simple HTML DOM, i try to crawl about 10k links but in some cases it prints <strong>IF</strong> is inside <code>&lt;a tag</code> ,divs code, images code, etc.</p>
  
  <p>if the <code>&lt;a tag</code> is standard(simple) like:</p>
  
  <pre><code>&lt;a href="http://www.test.com"&gt;Anchor Text&lt;/a&gt;
  </code></pre>
  
  <p>so in this case $element->innertext will be "Anchor Text"</p>
  
  <p><strong>BUT</strong></p>
  
  <p>if the cases is like this:</p>
  
  <pre><code>1    &lt;a href="http://www.test.com"&gt;&lt;div id=whatever&gt;Anchor Text&lt;/div&gt;&lt;/a&gt;
  </code></pre>
  
  <p>or</p>
  
  <pre><code>2    &lt;a href="http://www.test.com"&gt;&lt;img src="whatever" /&gt;&lt;/a&gt;
  </code></pre>
  
  <p>my <code>$element-&gt;innertext</code> will be:</p>
  
  <pre><code>Result1 &lt;div id=whatever&gt;Anchor Text&lt;/div&gt;
  Result2 &lt;img src="whatever" /&gt;
  </code></pre>
  
  <p>Is there any change to print ONLY the text or should i write my own custom conditions for each case: div, img, etc?</p>