function Mbstring::html_encoding_callback
File
-
vendor/
symfony/ polyfill-mbstring/ Mbstring.php, line 912
Class
- Mbstring
- Partial mbstring implementation in PHP, iconv based, UTF-8 centric.
Namespace
Symfony\Polyfill\MbstringCode
private static function html_encoding_callback(array $m) {
$i = 1;
$entities = '';
$m = unpack('C*', htmlentities($m[0], \ENT_COMPAT, 'UTF-8'));
while (isset($m[$i])) {
if (0x80 > $m[$i]) {
$entities .= \chr($m[$i++]);
continue;
}
if (0xf0 <= $m[$i]) {
$c = ($m[$i++] - 0xf0 << 18) + ($m[$i++] - 0x80 << 12) + ($m[$i++] - 0x80 << 6) + $m[$i++] - 0x80;
}
elseif (0xe0 <= $m[$i]) {
$c = ($m[$i++] - 0xe0 << 12) + ($m[$i++] - 0x80 << 6) + $m[$i++] - 0x80;
}
else {
$c = ($m[$i++] - 0xc0 << 6) + $m[$i++] - 0x80;
}
$entities .= '&#' . $c . ';';
}
return $entities;
}