note 32789 deleted from function.preg-match-all by sniper
| From: | sniper@php.net | Date: | Tue, 30 Sep 2003 12:23:27 +0000 |
| Subject: | note 32789 deleted from function.preg-match-all by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57439@lists.php.net to get a copy of this message | ||
Note Submitter: christian@sakshaug.net
----
This worked better when the string was from a xHTML text editor
---
function _get_images($string) {
preg_match_all( '/\<img.*?\>/',$string,$tags);
for ($count=0; $count < sizeof($tags[0]) ; $count++) {
preg_match_all( '/src=\".*?\"/', $tags[0][$count], $img);
for ($x=0; $x < sizeof($img[0]) ; $x++) {
$final_name[]=str_replace("src=","",str_replace("\"","
", $img[0][$x]));
}
}
return($final_name);
}
---
Output:
Array
(
[0] => picture1.jpg
[1] => picture2.jpg
[2] => picture3.jpg
)