note 34395 added to function.htmlentities
| From: | defrostdj at defrostdj dot com | Date: | Fri, 25 Jul 2003 17:10:19 +0000 |
| Subject: | note 34395 added to function.htmlentities | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-52651@lists.php.net to get a copy of this message | ||
Here you have a character map function ;)
<?php
function htmldecode($encoded, $char = 'HTML_SPECIALCHARS') {
foreach($encoded as $key => $value){
echo $value .' --> ';
if ($char == 'HTML_SPECIALCHARS') {
echo htmlspecialchars($value);
} else {
echo htmlentities($value);
}
echo '>br<';
}
}
echo 'ENTITIES<>br<><>br<>';
$entities = get_html_translation_table (HTML_ENTITIES);
htmldecode($entities, 'HTML_ENTITIES');
echo '<>br<>SPECIAL
CHARACTERS<>br<><>br<>';
$specialchars = get_html_translation_table (HTML_SPECIALCHARS);
htmldecode($specialchars, 'HTML_SPECIALCHARS');
?>
So next time you're developing you'll always have a charmap ready to use.
----
Manual Page -- http://www.php.net/manual/en/function.htmlentities.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34395
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34395&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34395&report=yes