(PHP 7, PHP 8)
IntlChar::getPropertyName — Devuelve el nombre Unicode de una propiedad
$property
, int $type
= IntlChar::LONG_PROPERTY_NAME): string|falseDevuelve 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().
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
.
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
.
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)