$pattern = '~<(/?(?:strong|p|em|a|ol|ul|li|img|iframe)\b.*?)>~is';
$contenu = preg_replace_callback($pattern, function ($m) {
return '<' . html_entity_decode($m[1], ENT_QUOTES, 'UTF_8') . '>'; }, $contenu);
How can I replace the code with preg_replace_callback()? (/e) [duplicate]
-
09-10-2022 - |
Pergunta
$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);
Solução
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow