We have a cycle:
$i = 0; while($count>$i) { $bvc = trim($slovo[$i]); $trans = array($bvc => ' '); $chist = strtr($tova, $trans); $i++; } echo $chist;
We need to output the data from the $ chist variable, where all entries should be deleted. Now one entry is deleted - the last one.
Complete script (with fix from KiTE, does not work):
$trr = '<div class="category"><a href="#" rel="tag" title="">продукция</a> <a href="#" rel="tag" title="">хозяйство</a> <a href="#" rel="tag" title="">хранение</a></div>'; $sttr = $trr.'<div class="actions_tags"><a href='#'>продукция</a>, <a href='#'>хранение</a></div>'; preg_match('|<div class="category">(.*)</div>|Uis', $sttr, $p_category); preg_match('|<div class="actions_tags">(.*)</div>|Uis', $sttr, $p_keywords); $p_keywords[1] = strip_tags($p_keywords[1]); $p_category[1] = strip_tags($p_category[1]); $explode = explode(",", $p_keywords[1]); $exp_count = count($explode); $ing = 0; //Начало исправления KiTE $chist = ''; while($exp_count>$ing) { $bvc = trim($explode[$ing]); $trans = array($bvc => ' '); $chist .= strtr($p_category[1], $trans); $ing++; } echo $chist; //Конец
The contents of $ trr and $ sttr are constantly changing.