PHP 8.4.0 RC3 available for testing

IntlChar::getPropertyValueName

(PHP 7, PHP 8)

IntlChar::getPropertyValueNameRenvoie le nom Unicode pour une valeur de propriété

Description

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

Renvoie 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, pas IntlChar::PROPERTY_GENERAL_CATEGORY. Ceux-ci incluent :

  • "C" / "Autre"
  • "L" / "Lettre"
  • "LC" / "Lettre_Majuscule"
  • "M" / "Marque"
  • "N" / "Nombre"
  • "P" / "Ponctuation"
  • "S" / "Symbole"
  • "Z" / "Séparateur"

Liste de paramètres

property

La 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 :

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.

Valeurs de retour

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.

Exemples

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)
add a note

User Contributed Notes

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