note 78371 added to function.htmlentities

From: Date: Tue, 09 Oct 2007 01:29:14 +0000
Subject: note 78371 added to function.htmlentities
Groups: php.notes 
Request: Send a blank email to php-notes+get-131241@lists.php.net to get a copy of this message
Another version of the xml special characters string conversion, this one also takes care of ascii chars in range 128 to 255 $asc2uni = Array(); for($i=128;$i<256;$i++){ $asc2uni[chr($i)] = "&#x".dechex($i).";"; } function XMLStrFormat($str){ global $asc2uni; $str = str_replace("&", "&amp;", $str); $str = str_replace("<", "&lt;", $str); $str = str_replace(">", "&gt;", $str); $str = str_replace("'", "&apos;", $str); $str = str_replace("\"", "&quot;", $str); $str = str_replace("\r", "", $str); $str = strtr($str,$asc2uni); return $str; } ---- Server IP: 203.16.234.20 Probable Submitter: 203.53.250.30 ---- Manual Page -- http://www.php.net/manual/en/function.htmlentities.php Edit -- https://master.php.net/note/edit/78371 Del: integrated -- https://master.php.net/note/delete/78371/integrated Del: useless -- https://master.php.net/note/delete/78371/useless Del: bad code -- https://master.php.net/note/delete/78371/bad+code Del: spam -- https://master.php.net/note/delete/78371/spam Del: non-english -- https://master.php.net/note/delete/78371/non-english Del: in docs -- https://master.php.net/note/delete/78371/in+docs Del: other reasons-- https://master.php.net/note/delete/78371 Reject -- https://master.php.net/note/reject/78371 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#131241) next »