array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'intlchar.chardigitvalue.php', 1 => 'IntlChar::charDigitValue', ), 'up' => array ( 0 => 'class.intlchar.php', 1 => 'IntlChar', ), 'prev' => array ( 0 => 'intlchar.charage.php', 1 => 'IntlChar::charAge', ), 'next' => array ( 0 => 'intlchar.chardirection.php', 1 => 'IntlChar::charDirection', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/intl/intlchar/chardigitvalue.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 7, PHP 8)
IntlChar::charDigitValue — 10進数の桁の文字を桁の値として取得する
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)