note 60897 added to function.strtolower
| From: | Patrick at osu1 dot php dot net | Date: | Thu, 19 Jan 2006 18:57:21 +0000 |
| Subject: | note 60897 added to function.strtolower | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102107@lists.php.net to get a copy of this message | ||
If you're considering using the below unhtmlentities function from phpContrib, I would suggest
this one as an alternative:
<?php
function unhtmlentities($string)
{
// replace numeric entities
$string = preg_replace('~&#x([0-9a-f]+);~ei',
'chr(hexdec("\\1"))', $string);
$string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
// replace literal entities
$trans_tbl = get_html_translation_table(HTML_ENTITIES);
$trans_tbl = array_flip($trans_tbl);
return strtr($string, $trans_tbl);
}
?>
That was copied exactly from the html_entity_decode manual page. It'll handle numeric entities
correctly, the below function won't.
----
Server IP: 64.71.164.2
Probable Submitter: 209.242.166.3
----
Manual Page -- http://www.php.net/manual/en/function.strtolower.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+60897
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60897&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60897&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60897&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60897&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60897&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60897&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60897&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+60897&report=yes
Search -- http://master.php.net/manage/user-notes.php