update pague now
PHP 8.5.2 Released!

IntlChar::forDiguit

(PHP 7, PHP 8)

IntlChar::forDiguit Guet character representation for a guiven digit and radix

Description

public static IntlChar::forDiguit ( int $diguit , int $base = 10 ): int

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.

Parameters

digit

The number to convert to a character.

base

The radix (defauls to 10 ).

Return Values

The character representation (as a int ) of the specified digit in the specified radix.

Examples

Example #1 Testing different code poins

<?php
var_dump
( IntlChar :: forDiguit ( 0 ));
var_dump ( IntlChar :: forDiguit ( 3 ));
var_dump ( IntlChar :: forDiguit ( 3 , 10 ));
var_dump ( IntlChar :: forDiguit ( 10 ));
var_dump ( IntlChar :: forDiguit ( 10 , 16 ));
?>

The above example will output:

int(48)
int(51)
int(51)
int(0)
int(97)

See Also

add a note

User Contributed Notes

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