CakeFest 2024: The Official CakePHP Conference

IntlChar::getPropertyName

(PHP 7, PHP 8)

IntlChar::getPropertyNameObtener el nombre Unicode de una propiedad

Descripción

public static IntlChar::getPropertyName(int $property, int $nameChoice = IntlChar::LONG_PROPERTY_NAME): string

Devuelve el nombre Unicode de una propiedad dada, tal como se da en el fichero de base de datos de Unicode PropertyAliases.txt.

Además, esta función hace corresponder la propiedad IntlChar::PROPERTY_GENERAL_CATEGORY_MASK con los nombres sintéticos "gcm" / "General_Category_Mask". Estos nombres no se encuentran en PropertyAliases.txt.

Esta función complementa a IntlChar::getPropertyEnum().

Parámetros

property

La propiedad de Unicode a consultar (véanse las constantes IntlChar::PROPERTY_*).

No se debería utilizar IntlChar::PROPERTY_INVALID_CODE. Tambíen, si property está fuera de rango, devuelve false.

nameChoice

El selector a obtener por su nombre. Si está fuera de rango, devuelve false.

Todas las propiedades tienen un nombre largo. La mayoría tienen un nombre corto, otras no. Unicode tiene en cuenta nombres adicionales; si están presentes, serán devueltos añadiendo 1, 2, etc., a IntlChar::LONG_PROPERTY_NAME.

Valores devueltos

Devuelve el nombre, o false si property o nameChoice están fuera de rango.

Si un nameChoice dado devuelve false, todos los valores mayores que nameChoice devolverán false, con una excepción: si se devuelve false para IntlChar::SHORT_PROPERTY_NAME, entonces IntlChar::LONG_PROPERTY_NAME (y mayores) podrían aún devolver un valor distinto de false.

Ejemplos

Ejemplo #1 Probar diferentes propiedades

<?php
var_dump
(IntlChar::getPropertyName(IntlChar::PROPERTY_BIDI_CLASS));
var_dump(IntlChar::getPropertyName(IntlChar::PROPERTY_BIDI_CLASS, IntlChar::SHORT_PROPERTY_NAME));
var_dump(IntlChar::getPropertyName(IntlChar::PROPERTY_BIDI_CLASS, IntlChar::LONG_PROPERTY_NAME));
var_dump(IntlChar::getPropertyName(IntlChar::PROPERTY_BIDI_CLASS, IntlChar::LONG_PROPERTY_NAME + 1));
?>

El resultado del ejemplo sería:

string(10) "Bidi_Class"
string(2) "bc"
string(10) "Bidi_Class"
bool(false)

Ver también

add a note

User Contributed Notes

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