CakeFest 2024: The Official CakePHP Conference

IntlChar::charDigitValue

(PHP 7, PHP 8)

IntlChar::charDigitValueObtener el valor del dígito decimal de un carácter de dígito decimal

Descripción

public static IntlChar::charDigitValue(mixed $codepoint): int

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

Estos caracteres tienen la categoría general "Nd" (número de dígito decimal) 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 del dígito decimal de codepoint, o -1 si no es un carácter de dígito decimal.

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