Can anyone help me with the following code. It is to strip out tages from within a DIV. I am getting a preg_replace() Unknown modifier '\' error
function strip_selected_tags_by_id_or_class($array_of_id_or_class, $text)
{
$array_quoted = array_map('preg_quote', $array_of_id_or_class);
$name = implode('|', $array_quoted);
$regex = '/<(\w+)\s[^>]*(?:class|id)\s*=\s*([\'"])(?:' . $name .
')\2[^>]*>.*</\\1>/isU';
return(preg_replace($regex, '', $text));
}
// arr is the ID of the DIV
$arr[] = "Occasion";
$text = "";
print_r(strip_selected_tags_by_id_or_class($arr, $text));
Any help would be ace! 🙂