PHP preg_match_all获取所有图像到数组

Pretty much self explanatory...

Here is my code :

$html=<<<EOF

<img src="smiley.gif" alt="Smiley face" height="42" width="42"> 
<img  alt="title" height="120" width="50" src="title.jpg" />
<img  alt=Footer src=footer.bmp height=30 width=47     />
<br>
<img  alt=Footer  height=10 src='square.jpeg' width=10     />
<div id="test"><img      longdesc="" width=100 src="transparent.png" height=43></div>
EOF;

preg_match_all("//",$html,$images);

I want to be able to return all image files to an array with preg_match_all (or any other magic :)

I'm expecting to get an array with all pictures so var_dump($images); would be:

smiley.gif
title.jpg
footer.bmp
square.jpeg
transparent.png
preg_match_all('/<img(.*?)src=("|\'|)(.*?)("|\'| )(.*?)>/s', $html, $images);
var_dump($images[3]);

you can use Simple HTML DOM Parser or PHP DOMDocument, vor example:

$doc = new DOMDocument();
$doc->loadHTML($htmlstring);
$elements = $doc->getElementsByTagName('img');

foreach($elements as $element) {
 print $element->getAttribute('src');
}