function AbstractUnicodeString::fromCodePoints
File
-
vendor/
symfony/ string/ AbstractUnicodeString.php, line 51
Class
- AbstractUnicodeString
- Represents a string of abstract Unicode characters.
Namespace
Symfony\Component\StringCode
public static function fromCodePoints(int ...$codes) : static {
$string = '';
foreach ($codes as $code) {
if (0x80 > ($code %= 0x200000)) {
$string .= \chr($code);
}
elseif (0x800 > $code) {
$string .= \chr(0xc0 | $code >> 6) . \chr(0x80 | $code & 0x3f);
}
elseif (0x10000 > $code) {
$string .= \chr(0xe0 | $code >> 12) . \chr(0x80 | $code >> 6 & 0x3f) . \chr(0x80 | $code & 0x3f);
}
else {
$string .= \chr(0xf0 | $code >> 18) . \chr(0x80 | $code >> 12 & 0x3f) . \chr(0x80 | $code >> 6 & 0x3f) . \chr(0x80 | $code & 0x3f);
}
}
return new static($string);
}