« IntlChar::charAge
IntlChar::charDirection »

IntlChar::charDigitValue

(PHP 7, PHP 8)

IntlChar::charDigitValue — 10進数の桁の文字を桁の値として取得する

説明

public static function IntlChar::charDigitValue(int|string $codepoint): ?int

10進数の桁の文字を、桁の値として取得します。

対象となる文字は、一般カテゴリ "Nd" (decimal digit numbers) と a Numeric_Type of Decimal に属するものです。

パラメータ

codepoint

コードポイントを表す int 型の値 (例: U+2603 SNOWMAN を表す 0x2603)、あるいは UTF-8 文字列としてエンコードされた文字 (例: "\u{2603}")。

戻り値

codepoint の10進数の桁の値を返します。 10進数の桁の文字でない場合は、-1 を返します。 失敗した場合は、null を返します。

例

例1 さまざまなコードポイントの例

<?php
var_dump(IntlChar::charDigitValue("1"));
var_dump(IntlChar::charDigitValue("\u{0662}"));
var_dump(IntlChar::charDigitValue("\u{0E53}"));
?>

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

int(1)
int(2)
int(3)

参考

関連キーワード:
IntlChar   charDigitValue   codepoint   コード   ポイント   dump   charAge   charDirection   static   一般   カテゴリ   decimal   digit   numbers   Numeric   Type   Decimal   エンコード   参考   getNumericValue   Unicode   数値
関連する関数・ページ:
intlchar.charage   class.intlchar   intlchar.chr   intlchar.getnumericvalue   intlchar.ord   intlchar.chardirection