IntlChar::chr
(PHP 7)
IntlChar::chr — Return Unicode character by code point value
説明
public static IntlChar::chr
( mixed $codepoint
) : string
Returns a string containing the character specified by the Unicode code point value.
This function compliments IntlChar::ord().
パラメータ
codepoint
- コードポイントを表す int 型の値 (例: U+2603 SNOWMAN を表す
0x2603
)、あるいは UTF-8 文字列としてエンコードされた文字 (例:"\u{2603}"
)。
返り値
A string containing the single character specified by the Unicode code point value.
例
例1 さまざまなコードポイントの例
<?php$values = ["A", 63, 123, 9731];foreach ($values as $value) { var_dump(IntlChar::chr($value));}?>
上の例の出力は以下となります。
string(1) "A" string(1) "?" string(1) "{" string(3) "☃"