IntlChar::chr

(PHP 7, PHP 8)

IntlChar::chrReturn 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 complements 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"631239731];
foreach (
$values as $value) {
    
var_dump(IntlChar::chr($value));
}
?>

上の例の出力は以下となります。

string(1) "A"
string(1) "?"
string(1) "{"
string(3) "☃"

参考

  • IntlChar::ord() - Return Unicode code point value of character
  • mb_chr() - Unicode のコードポイントに対応する文字を返す
  • chr() - 数値から、1バイトの文字列を生成する

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top