title: how can i get first img from html code by php
body: <p>i want get first img from html code by php</p>
  
  <p>i have this code</p>
  
  <pre><code>$text = '
  &lt;b&gt;hello&lt;/b&gt;
  this is the first img
  &lt;img src="http://localhost/1.png" title="first img" /&gt;
  other img
  &lt;img src="http://localhost/2.png" title="other" /&gt;
  ';
  </code></pre>
  
  <p>I want the first source image in a new variable </p>
  
  <pre><code>http://localhost/1.png
  </code></pre>
  
  <p>thanks </p>