IntlChar::getPropertyName

(PHP 7, PHP 8)

IntlChar::getPropertyNameDevuelve el nombre Unicode de una propiedad

Descripción

public static IntlChar::getPropertyName(int $property, int $type = IntlChar::LONG_PROPERTY_NAME): string|false

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

Además, esta función mapea la propiedad IntlChar::PROPERTY_GENERAL_CATEGORY_MASK a los nombres sintéticos "gcm" / "General_Category_Mask". Estos nombres no están en PropertyAliases.txt.

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

Parámetros

property

The Unicode property to lookup (see the IntlChar::PROPERTY_* constants).

IntlChar::PROPERTY_INVALID_CODE no debe ser utilizado. Además, si property está fuera de rango, false es devuelto.

type

El selector para el nombre a obtener. Si está fuera de rango, false es devuelto.

Todas las propiedades tienen un nombre largo. La mayoría tienen un nombre corto, pero algunas no lo tienen. Unicode permite 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 type están fuera de rango.

Si un type dado devuelve false, entonces todos los valores más grandes de type devolverán false, con una excepción: si false es devuelto para IntlChar::SHORT_PROPERTY_NAME, entonces IntlChar::LONG_PROPERTY_NAME (y más) puede aún devolver un valor no-false.

Ejemplos

Ejemplo #1 Testing different properties

<?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 ejemplo anterior mostrará :

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