title: Get multiple image src from a string in PHP
body: <pre><code>$string = "&lt;p&gt;dsaasdsdsdas sdhio ahsas asdsad adhaso img da sda a asd a as src asdasd ds.&lt;/p&gt;   &lt;p&gt;dsaasdsdsdas sdhio ahsas asdsad adhaso img da sda a asd a as src asdasd ds.&lt;/p&gt;  &lt;p&gt;dsaasdsdsdas &lt;img src='http://stie.com/teste.jpg'&gt; ds.&lt;/p&gt;   &lt;p&gt;dsaasdsdsdas sdhio ahsas asdsad adhaso img da sda a asd &lt;img src='http://segunda.com/teste.jpg'&gt; a as src asdasd ds.&lt;/p&gt;     &lt;p&gt;dsaasdsdsdas sdhio ahsas asdsad adhaso img da sda a asd a as src asdasd ds.&lt;/p&gt;";
  
  $doc = new DOMDocument();   
  $doc-&gt;loadHTML($string);    
  $xpath = new DOMXPath($doc);    
  $src = $xpath-&gt;evaluate("string(//img/@src)");
  
  echo $src;
  </code></pre>
  
  <p>I have this code to try to extract all img sources from a string in PHP.
  But my code have an issue, if it has more than one image, it only get the first image src. How can I change this to give me all image src in a string, to an array for example?</p>