I tried cleaning inside of pre tags only. It keeps the rest of the post fixed, and removes the newlines from within the pre tags. However the break tags still remain
http://stackoverflow.com/questions/82174...sing-nl2br
function my_nl2br($string){ $string = str_replace("\n", "<br />", $string); if(preg_match_all('/\<pre\>(.*?)\<\/pre\>/', $string, $match)){ foreach($match as $a){ foreach($a as $b){ $string = str_replace('<pre>'.$b.'</pre>', "<pre>".str_replace("<br />", "", $b)."</pre>", $string); } } } return $string; }apparently other people have the same problem
http://stackoverflow.com/questions/82174...sing-nl2br
Recommended Tutorials: