note 127026 added to function.htmlentities
| From: | j2teamnnl at gmail dot com | Date: | Wed, 04 May 2022 09:31:05 +0000 |
| Subject: | note 127026 added to function.htmlentities | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-218338@lists.php.net to get a copy of this message | ||
The answer above is not correct for multiple languages like France
I had correct it
function xml_entities($strIn)
{
if (is_numeric($strIn)) {
return $strIn;
}
$strOut = null;
$arrStr = mb_str_split($strIn);
foreach ($arrStr as $char) {
$ord = mb_ord($char);
if (($ord > 0 && $ord < 32) || ($ord >= 127)) {
$strOut .= "&#{$ord};";
}
else {
switch ($char) {
case '<':
$strOut .= '<';
break;
case '>':
$strOut .= '>';
break;
case '&':
$strOut .= '&';
break;
case '"':
$strOut .= '"';
break;
default:
$strOut .= $char;
}
}
}
return $strOut;
}
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 2405:4803:fddc:22c0:b48a:12cd:99f5:9253)
----
Manual Page -- https://php.net/manual/en/function.htmlentities.php
Edit -- https://main.php.net/note/edit/127026
Del: integrated -- https://main.php.net/note/delete/127026/integrated
Del: useless -- https://main.php.net/note/delete/127026/useless
Del: bad code -- https://main.php.net/note/delete/127026/bad+code
Del: spam -- https://main.php.net/note/delete/127026/spam
Del: non-english -- https://main.php.net/note/delete/127026/non-english
Del: in docs -- https://main.php.net/note/delete/127026/in+docs
Del: other reasons-- https://main.php.net/note/delete/127026
Reject -- https://main.php.net/note/reject/127026
Search -- https://main.php.net/manage/user-notes.php