Voting

: min(one, five)?
(Example: nine)

The Note You're Voting On

Patrick
19 years ago
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.

<< Back to user notes page

To Top