cvs: phpdoc /en/reference/strings/functions html-entity-decode.xml

From: Date: Mon, 11 Jul 2005 08:33:44 +0000
Subject: cvs: phpdoc /en/reference/strings/functions html-entity-decode.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969369053@lists.php.net to get a copy of this message
vrana Mon Jul 11 04:33:44 2005 EDT Modified files: /phpdoc/en/reference/strings/functions html-entity-decode.xml Log: Replace numeric entities in userland function (spotted by Goba) http://cvs.php.net/diff.php/phpdoc/en/reference/strings/functions/html-entity-decode.xml?r1=1.9&r2=1.10&ty=u Index: phpdoc/en/reference/strings/functions/html-entity-decode.xml diff -u phpdoc/en/reference/strings/functions/html-entity-decode.xml:1.9 phpdoc/en/reference/strings/functions/html-entity-decode.xml:1.10 --- phpdoc/en/reference/strings/functions/html-entity-decode.xml:1.9 Sun Mar 14 11:28:30 2004 +++ phpdoc/en/reference/strings/functions/html-entity-decode.xml Mon Jul 11 04:33:42 2005 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.9 $ --> +<!-- $Revision: 1.10 $ --> <!-- splitted from ./en/functions/strings.xml, last change in rev 1.2 --> <refentry id="function.html-entity-decode"> <refnamediv> @@ -78,6 +78,10 @@ // For users prior to PHP 4.3.0 you may do this: 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);

« previous php.doc (#969369053) next »