note 57200 added to function.htmlentities
| From: | explosion at explosiondigital dot com | Date: | Tue, 27 Sep 2005 03:32:59 +0000 |
| Subject: | note 57200 added to function.htmlentities | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-95847@lists.php.net to get a copy of this message | ||
<?
# 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á"
?>
----
Manual Page -- http://www.php.net/manual/en/function.htmlentities.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57200
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57200&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57200&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57200&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57200&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57200&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57200&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57200&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57200&report=yes
Search -- http://master.php.net/manage/user-notes.php