PHP 8.5.0 Alpha 1 available for testing

IntlChar::charDigitValue

(PHP 7, PHP 8)

IntlChar::charDigitValueDevuelve el valor decimal del dígito decimal

Descripción

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

Devuelve el valor decimal del carácter dígito decimal.

Tales caracteres tienen la categoría general "Nd" (dígitos decimales) y un Numeric_Type de Decimal.

Parámetros

codepoint

El valor de tipo integer del punto de código (p.ej. 0x2603 para U+2603 SNOWMAN), o el carácter codificado como un string UTF-8 (p.ej. "\u{2603}")

Valores devueltos

El valor decimal del carácter dígito decimal, o -1 si no es un carácter decimal. Devuelve null en caso de fallo.

Ejemplos

Ejemplo #1 Probar diferentes puntos de código

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

El resultado del ejemplo sería:

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

Ver también

add a note

User Contributed Notes

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