fetch all images src into array with file get content
<p>i have the following function for getting images...</p>

<pre><code>function getImages($content){
    $regex = '/&lt;img src=\"([^\"]*)(")/iU';
    preg_match_all($regex,$content,$match);
    var_dump($match);
    return $match[0];
}
</code></pre>

<p>and here i am calling it...</p>

<pre><code>$link = "http://mydomain.com";
$content = file_get_contents($link);
$img = getImages($content);
echo $img;
</code></pre>

<p>it is working all the way fine but the problem is that it shows me a lot of text along with images like</p>

<pre><code>array(3) { [0]=&gt; array(27) { [0]=&gt; string(37)
tring(106) "http://cdn3.diggstatic.com/story/reddit_open_to_chat_over_ben_cheezburger_huh_s_proposed_acquisition/t.png" } [2]=&gt; array(27) { [0]=&gt; string(1) """ [1]=&gt; string(1) """ [2]=&gt; string(1) """ [3]=&gt; string(1) """ [4]=&gt; string(1) """ [5]=&gt; string(1) """ [6]=&gt; string(1) """ [7]=&gt; string(1) """ [8]=&gt; string(1) """ [9]=&gt; string(1) """ [10]=&gt; string(1) """ [11]=&gt; string(1) """ [12]=&gt; string(1) """ [13]=&gt; string(1) """ [14]=&gt; string(1) """ [15]=&gt; string(1) """ [16]=&gt; string(1) """ [17]=&gt; string(1) """ [18]=&gt; string(1) """ [19]=&gt; string(1) """ [20]=&gt; string(1) """ [21]=&gt; string(1) """ [22]=&gt; string(1) """ [23]=&gt; string(1) """ [24]=&gt; string(1) """ [25]=&gt; string(1) """ [26]=&gt; string(1) """ } }
</code></pre>

<p>while i only want to get images...how can i remove all that text and get all images</p>
