How can I convert the code inside the and tags to html entities ?
a
PHP
if(preg_match_all('#\<(code|pre) class\=\"php\"\>(.*?)\(code|pre)\>#is', $html, $code)){
unset($code[0]);
foreach($code as $array){
foreach($array as $value){
$html = str_replace($value, htmlentities($value, ENT_QUOTES), $html);
}
}
}
HTML
<div> a div.. </div>
<div> a div.. </div>
this should be ignored
Have you ever heard of BB code? http://en.wikipedia.org/wiki/BBCode