function Mbstring::mb_chr
1 call to Mbstring::mb_chr()
- Mbstring::mb_decode_numericentity in vendor/
symfony/ polyfill-mbstring/ Mbstring.php
File
-
vendor/
symfony/ polyfill-mbstring/ Mbstring.php, line 794
Class
- Mbstring
- Partial mbstring implementation in PHP, iconv based, UTF-8 centric.
Namespace
Symfony\Polyfill\MbstringCode
public static function mb_chr($code, $encoding = null) {
if (0x80 > ($code %= 0x200000)) {
$s = \chr($code);
}
elseif (0x800 > $code) {
$s = \chr(0xc0 | $code >> 6) . \chr(0x80 | $code & 0x3f);
}
elseif (0x10000 > $code) {
$s = \chr(0xe0 | $code >> 12) . \chr(0x80 | $code >> 6 & 0x3f) . \chr(0x80 | $code & 0x3f);
}
else {
$s = \chr(0xf0 | $code >> 18) . \chr(0x80 | $code >> 12 & 0x3f) . \chr(0x80 | $code >> 6 & 0x3f) . \chr(0x80 | $code & 0x3f);
}
if ('UTF-8' !== ($encoding = self::getEncoding($encoding))) {
$s = mb_convert_encoding($s, $encoding, 'UTF-8');
}
return $s;
}