How to replace htmlentities using HTML Tags using PHP str_replace

Viewed 9512

I have a content like below.

I want the <pre></pre> to be converted to <p> </p>. But i'm not able achieve it. Below is an example

$content = "<pre>This is a pre text &#13; I want to convert it to paragraphs ";

print_r(str_replace(array('<pre>', '</pre>', '&#13;'),array('<p>', '</p>', '<br/>'),htmlspecialchars($content)));

But i get the output as it is. Can someone help me resolve. Thanks in advance

3 Answers
Related