Reputation: 499
In my database I have saved,
<p>& sign test</p> <p><>greater than and less than</p>
I am using these for document download. I want replace these special characters &
and <>
with &
and <>
respectively.
How can I detect special characters from the above html content?
Upvotes: -2
Views: 352
Reputation: 1671
$orig = "I'll \"walk\" the <b>dog</b> now";
$a = htmlentities($orig);
$b = html_entity_decode($a);
echo $a; // I'll "walk" the <b>dog</b> now
echo $b; // I'll "walk" the <b>dog</b> now
or you can use your custom function if you dont want html tag to convert into unicode :
$text = str_replace(array(""", "&"), array("\"", "&"), $text);
Upvotes: 1