note 58969 deleted from function.strpos by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 16:37:47 +0000 |
| Subject: | note 58969 deleted from function.strpos by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-154867@lists.php.net to get a copy of this message | ||
Note Submitter: rycardo74 at gmail dot com
----
this function return all src properties from a html text
in array you can filter the specifics html tags with strip_tags
$HTML=strip_tags ( $HTML, '<img>' );
$tag = trip_tag_prop("src=\"" , "\"" , $HTML);
function trip_tag_prop($ini,$end,$HTML ){
$ini_len= strlen($ini);
$end_len= strlen($end);
$inizio_pos=0;
while($inizio_pos = strpos ( $HTML, $ini, $inizio_pos)){
$fine_pos = strpos ( $HTML, $end,($inizio_pos + $ini_len));
$tag[] = substr ( $HTML, $inizio_pos + $ini_len ,($fine_pos - $inizio_pos - $ini_len) );
$inizio_pos=$fine_pos;
}
return $tag;
}
by :Auayama , cabrera rycardo74 (a) gmail (dot) com