title: Replace image inside HTML if we only know the image source
body: <p>I have an HTML with a number of images inside it. Suppose I have one url which is of one of the images inside the HTML content. What if I have to replace the image inside HTML with some custom text in PHP?</p>
  
  <pre><code>&lt;div&gt;
   &lt;p&gt;Some text&lt;img src="a.jpg" class="testclass" alt="image" title="image"/&gt;&lt;/p&gt;
   &lt;p&gt;Some more text&lt;img src="b.jpg" class="testclass2" alt="image2" title="image2"/&gt;&lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And suppose I have to replace <code>&lt;img src="a.jpg" class="testclass" alt="image" title="image"/&gt;</code> with some custom text but the only information I have is the image URL i.e "a.jpg". How to do it in PHP?</p>