$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);
Asked
Active
Viewed 155 times
-1

Casimir et Hippolyte
- 88,009
- 5
- 94
- 125

julienetnel
- 3
- 2
-
1http://stackoverflow.com/questions/how-to-ask – chanchal118 Feb 10 '14 at 12:55
-
How can I replace the code with preg_replace_callback()? – julienetnel Feb 10 '14 at 13:17
1 Answers
0
$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);

Casimir et Hippolyte
- 88,009
- 5
- 94
- 125