You are looking for html_entity_decode
How to convert special characters to html words through PHP?
Вопрос
I have so many special characters like this in mysql data while I am displaying in xml file through php.
—,”,’,“...etc
I want to convert as a original words using php.
Решение
Другие советы
$s = ' —,”,’,“';
echo html_entity_decode($s);
All you need is http://www.php.net/manual/en/function.html-entity-decode.php
You should go with htmlspecialchars_decode
as html_entity_decode
is a slighter - overkill version.
<?php
$s = '—,”,’,“';
echo htmlspecialchars_decode($s);
OUTPUT :
—,”,’,“
<?php
$orig = "I'll \"walk\" the <b>dog</b> now";
$a = htmlentities($orig);
echo $a; // I'll "walk" the <b>dog</b> now
$b = html_entity_decode($a);
echo $b; // I'll "walk" the <b>dog</b> now
?>
Не связан с StackOverflow