Entity encoding matched text : preg_replace « String « PHP
- PHP
- String
- preg_replace
Entity encoding matched text
<?php
$html = 'The <b> tag makes text bold: <code><b>bold</b></code>';
print preg_replace('@<code>(.*?)</code>@e',"html_entity_decode('$1')", $html);
?>
Related examples in the same category