array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'fr', ), 'this' => array ( 0 => 'intlchar.fordigit.php', 1 => 'IntlChar::forDigit', ), 'up' => array ( 0 => 'class.intlchar.php', 1 => 'IntlChar', ), 'prev' => array ( 0 => 'intlchar.foldcase.php', 1 => 'IntlChar::foldCase', ), 'next' => array ( 0 => 'intlchar.getbidipairedbracket.php', 1 => 'IntlChar::getBidiPairedBracket', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/intl/intlchar/fordigit.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 7, PHP 8)
IntlChar::forDigit — Get character representation for a given digit and radix
Determines the character representation for a specific digit in the specified radix.
If the value of radix is not a valid radix, or the value of digit is not a valid digit in the specified radix,
the null character (U+0000
) is returned.
The radix argument is valid if it is greater than or equal to 2
and less than or equal to 36
.
The digit argument is valid if 0 <= digit < radix
.
If the digit is less than 10
, then '0' + digit is returned. Otherwise, the value 'a' + digit - 10 is returned.
digit
The number to convert to a character.
base
The radix (defaults to 10
).
The character representation (as a string) of the specified digit in the specified radix.
Exemple #1 Test de différents codepoint
<?php
var_dump(IntlChar::forDigit(0));
var_dump(IntlChar::forDigit(3));
var_dump(IntlChar::forDigit(3, 10));
var_dump(IntlChar::forDigit(10));
var_dump(IntlChar::forDigit(10, 16));
?>
L'exemple ci-dessus va afficher :
int(48) int(51) int(51) int(0) int(97)
IntlChar::PROPERTY_NUMERIC_TYPE