shaileshpatil
11-26-2007, 05:40 AM
Hi
$string=' this is image 1 <img src="www.abc.com/abc.gif"'> and second is <img src="www.df.com/edfg.jpg">;
function getAttribs($t, $a, $s) {
preg_match_all("/(<".$t." .*?".$a.".*?=.*?\")(.*?)(\".*?>)/", $s, $m);
return $m[2];
}
$arr=getAttribs('img', 'src', $string);
Here i get all the src of <img> tag.
Now i want to replace the src part with something else.
How can i achieve this.
thanks in advance.
$string=' this is image 1 <img src="www.abc.com/abc.gif"'> and second is <img src="www.df.com/edfg.jpg">;
function getAttribs($t, $a, $s) {
preg_match_all("/(<".$t." .*?".$a.".*?=.*?\")(.*?)(\".*?>)/", $s, $m);
return $m[2];
}
$arr=getAttribs('img', 'src', $string);
Here i get all the src of <img> tag.
Now i want to replace the src part with something else.
How can i achieve this.
thanks in advance.