Ottenere il testo compreso tra due tag

Juna - 27 lug 2005 01:20

Questa funzione prende in input il codice html come stringa e restituisce il contenuto di un tag specificato come $item:

function regExpParse($str,$item)
{
$str = preg_replace("/\\s+/"," ",$str);
$str = trim($str);
preg_match_all("/<".$item.">.*?<\/".$item.">/",$str,$rest);
$items = $rest;
return $items;
}
 
Weblog Koan Progetti Foto Contatti DW.net map