Question

$in = '(<(/?(?:strong|p|em|a|ol|ul|li|img|iframe)\b.*?)>)ie';

$contenu = preg_replace($in, "'<'.html_entity_decode('$1',ENT_QUOTES,'UTF-8').'>'", $contenu);
Was it helpful?

Solution

$pattern = '~&lt;(/?(?:strong|p|em|a|ol|ul|li|img|iframe)\b.*?)&gt;~is';

$contenu = preg_replace_callback($pattern, function ($m) {
    return '<' . html_entity_decode($m[1], ENT_QUOTES, 'UTF_8') . '>'; }, $contenu);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top