Function name: mb_chr()
Function description: The mb_chr() function returns the characters that specify the Unicode code point.
Applicable version: PHP 7.2.0 and above
Usage: mb_chr(int $codepoint [, string $encoding = mb_internal_encoding()]): string
parameter:
- $codepoint: To get the Unicode code point value of the character.
- $encoding (optional): character encoding, default is mb_internal_encoding().
Return value: Returns a string containing the specified Unicode code point characters.
Example:
// 示例1:使用默认编码获取Unicode 码点为8364 的字符echo mb_chr(8364); // 输出:€ // 示例2:使用UTF-8 编码获取Unicode 码点为128640 的字符echo mb_chr(128640, 'UTF-8'); // 输出:??
Notes:
- This function requires support for the mbstring extension, ensuring that the extension is enabled.
- If no encoding is specified, the default encoding returned by the mb_internal_encoding() function is used.
- Make sure that the specified encoding can correctly parse the specified Unicode code points, otherwise you may get incorrect results.
- If the specified Unicode code point is outside the selected encoding range, characters may not be displayed correctly.