Php/docs/intlchar.chr

提供:Dev Guides
< Php
移動先:案内検索

IntlChar::chr

(PHP 7)

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 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) "☃"

参考

  • IntlChar::ord() - Return Unicode code point value of character
  • chr() - 数値から、1バイトの文字列を生成する