We have a script:
$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]); The list of words in the $ sttr variable is always separated by a comma, the content changes. We need to remove the matching of the variable data from $ p_category with the $ p_keywords variable.
Those. if in the $ p_category variable we had the data “Hello, how are you, this film will be released soon, don't you know?”, and in the $ p_keywords variable there was data “how are you, you do not know”, then the result should be “Hello, will this movie be out soon? " however, the removal / non-removal of these commas is not critical.
How to implement it? Related question: link .