note 32789 added to function.preg-match-all
| From: | christian at sakshaug dot net | Date: | Fri, 06 Jun 2003 20:52:44 +0000 |
| Subject: | note 32789 added to function.preg-match-all | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-49914@lists.php.net to get a copy of this message | ||
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
)
----
Manual Page -- http://www.php.net/manual/en/function.preg-match-all.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32789
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32789&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32789&report=yes