(PHP 7, PHP 8)
IntlChar::getPropertyValueName — Renvoie le nom Unicode pour une valeur de propriété
$property, int $value, int $type = IntlChar::LONG_PROPERTY_NAME): string|falseRenvoie le nom Unicode pour une valeur de propriété donnée, tel que donné dans le fichier de base de données Unicode PropertyValueAliases.txt.
Note:
Quelques noms dans PropertyValueAliases.txt ne peuvent être récupérés qu'en utilisant
IntlChar::PROPERTY_GENERAL_CATEGORY_MASK, pasIntlChar::PROPERTY_GENERAL_CATEGORY. Ceux-ci incluent :
- "C" / "Autre"
- "L" / "Lettre"
- "LC" / "Lettre_Majuscule"
- "M" / "Marque"
- "N" / "Nombre"
- "P" / "Ponctuation"
- "S" / "Symbole"
- "Z" / "Séparateur"
propertyLa propriété Unicode à chercher (voir la
constante IntlChar::PROPERTY_*).
Si hors de portée, ou si cette méthode ne fonctionne pas avec la valeur donnée, false est retourné.
value
Le sélecteur pour une valeur pour la propriété donnée. Si hors de portée, false est retourné.
En général, les valeurs valides vont de 0 jusqu'à un maximum. Il y a quelques exceptions :
IntlChar::PROPERTY_BLOCK les valeurs commencent à la valeur non-nulle IntlChar::BLOCK_CODE_BASIC_LATIN
IntlChar::PROPERTY_CANONICAL_COMBINING_CLASS les valeurs ne sont pas contiguës et vont de 0 à 240.
type
Le sélecteur pour le nom à obtenir. Si hors de portée, false est retourné.
Toutes les valeurs ont un nom long. La plupart ont un nom court, mais certaines n'en ont pas. Unicode permet des noms
supplémentaires; s'ils sont présents, ils seront retournés en ajoutant 1, 2, etc. à IntlChar::LONG_PROPERTY_NAME.
Renvoie le nom, ou false si soit property soit type
est hors de portée. Renvoie null en cas d'échec.
Si un type donné retourne false, alors tous les valeurs plus grandes de
type retourneront false, avec une exception : si false est retourné pour
IntlChar::SHORT_PROPERTY_NAME, alors IntlChar::LONG_PROPERTY_NAME
(et plus) peut encore retourner une valeur non-false.
Exemple #1 Test de différentes propriétés
<?php
var_dump(IntlChar::getPropertyValueName(IntlChar::PROPERTY_BLOCK, IntlChar::BLOCK_CODE_GREEK));
var_dump(IntlChar::getPropertyValueName(IntlChar::PROPERTY_BLOCK, IntlChar::BLOCK_CODE_GREEK, IntlChar::SHORT_PROPERTY_NAME));
var_dump(IntlChar::getPropertyValueName(IntlChar::PROPERTY_BLOCK, IntlChar::BLOCK_CODE_GREEK, IntlChar::LONG_PROPERTY_NAME));
var_dump(IntlChar::getPropertyValueName(IntlChar::PROPERTY_BLOCK, IntlChar::BLOCK_CODE_GREEK, IntlChar::LONG_PROPERTY_NAME + 1));
?>L'exemple ci-dessus va afficher :
string(16) "Greek_And_Coptic" string(5) "Greek" string(16) "Greek_And_Coptic" bool(false)