title: php get word between two different tags
body: <p>I am parsing a website using <code>DOMDocument</code> class.</p>
  
  <p>The html code is like this</p>
  
  <pre><code>&lt;img src="xxxxxx"&gt;
  abc
  &lt;br&gt;
  &lt;img src="xxxxxx"&gt;
  def
  &lt;br&gt;
  .....
  </code></pre>
  
  <p>What I want is to extract the img src link and the words between <code>&lt;img&gt;</code> tag and <code>&lt;br&gt;</code> tag as a pair. I am looping to get all the pairs inside the html code.</p>
  
  <p>I am able to get all <code>&lt;img&gt;</code> src using <code>getElementsByTagName</code> but I have no idea how can I get those words between img and br tag.</p>
  
  <p>Is there any method to pair those img src and the words?</p>
  
  <p>Thanks</p>