use html_entity_decode():
$newUrl = html_entity_decode('<a href="index.php?q=event&id=56&date=128">');
echo $newUrl; // prints <a href="index.php?q=event&id=56&date=128">
Use htmlspecialchars_decode. Example straight from the PHP documentation page:
$str = '<p>this -> "</p>';
echo htmlspecialchars_decode($str); // <p>this -> "</p>
after string go through TinyMCE only this code help me
$string = iconv('UTF-8','cp1251',$string);
$string = str_replace(chr(160), chr(32), $string);
$string = iconv('cp1251','UTF-8',$string);
There is no built in PHP function that will take an entity such as &
and turn it into a double &. Just in case there is any confusion, the html entity for & is actually &
, not amp;
, so running any built in parser on your example will return the following:
<a href="index.php?q=event&id=56&date=128">
and not
<a href="index.php?q=event&&id=56&&date=128">
In order to get the double & version, you will need to use a regular expression.
Alternatively, if you in fact want the single & version, you have two possibilities.
& " ' < >
then you should use htmlspecialchars_decode. This would be sufficient for the example you give.I suspect that htmlspecialchars_decode will be faster than html_entity_decode so if it covers all the entities you wish to convert, you should use that.