Вопрос

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.

Это было полезно?

Решение

You are looking for html_entity_decode

Другие советы

$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 = '&mdash;,&rdquo;,&rsquo;,&ldquo;';
echo htmlspecialchars_decode($s);

OUTPUT :

—,”,’,“
<?php
$orig = "I'll \"walk\" the <b>dog</b> now";

$a = htmlentities($orig);

  echo $a; // I'll &quot;walk&quot; the &lt;b&gt;dog&lt;/b&gt; now

$b = html_entity_decode($a);

  echo $b; // I'll "walk" the <b>dog</b> now
?>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top