title: PHP - How to extract achor href of specified linked image?
body: <p>How would i extract anchor href of given HTML, based on image src?</p>
  
  <p>Example:</p>
  
  <pre><code>&lt;a href="http://idontneedthis.com"&gt;&lt;img src="path/to/image/1.gif" /&gt;&lt;/a&gt;
  &lt;a href="http://iwantthis.com"&gt;&lt;img src="path/to/image/2.gif" /&gt;&lt;/a&gt;
  &lt;a href="http://idontneedthisagain.com"&gt;&lt;img src="path/to/image/3.gif" /&gt;&lt;/a&gt;
  </code></pre>
  
  <p>In this case i would need to get link of linked image with src of <code>2.gif</code>. That would be anchor that has href <code>http://iwantthis.com</code></p>