note 57200 deleted from function.htmlentities by betz
| From: | betz@php.net | Date: | Tue, 27 Sep 2005 06:31:51 +0000 |
| Subject: | note 57200 deleted from function.htmlentities by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-95852@lists.php.net to get a copy of this message | ||
Note Submitter: explosion at explosiondigital dot com
----
<?
# Nice job with the xmlentities, really cool.
# But just a little thing was missing, the unxmlentities
# functions. Then, there is it!
/**
* Return the original text changed by xmlentities function
* No string validade checked
* @author Thiago Mata
* @date 2005-09-27
* @version 1.0
* @param a xml string to be converted
* @return a string with special chars
*/
function unxmlentities($xmlString)
{
$pos = strpos($xmlString,"&");
while ($pos !== false)
{
$before = substr($xmlString,0,$pos);
$middle = substr($xmlString,$pos+2,3);
$after = substr($xmlString,$pos+6);
$middle = chr(($middle));
$xmlString = $before.$middle.$after;
$pos = strpos($xmlString,"&");
}
return $xmlString;
}
print unxmlentities("Thíägô Hènriqüê
Rãmos da Màtá");
# out "Thíägô Hènriqüê Rãmos da Màtá"
?>