array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'intlchar.getpropertyenum.php', 1 => 'IntlChar::getPropertyEnum', 2 => 'Get the property constant value for a given property name', ), 'up' => array ( 0 => 'class.intlchar.php', 1 => 'IntlChar', ), 'prev' => array ( 0 => 'intlchar.getnumericvalue.php', 1 => 'IntlChar::getNumericValue', ), 'next' => array ( 0 => 'intlchar.getpropertyname.php', 1 => 'IntlChar::getPropertyName', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/intl/intlchar/getpropertyenum.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

IntlChar::getPropertyEnum

(PHP 7, PHP 8)

IntlChar::getPropertyEnumGet the property constant value for a given property name

Beschreibung

public static IntlChar::getPropertyEnum(string $alias): int

Returns the property constant value for a given property name, as specified in the Unicode database file PropertyAliases.txt. Short, long, and any other variants are recognized.

In addition, this function maps the synthetic names "gcm" / "General_Category_Mask" to the property IntlChar::PROPERTY_GENERAL_CATEGORY_MASK. These names are not in PropertyAliases.txt.

This function complements IntlChar::getPropertyName().

Parameter-Liste

alias

The property name to be matched. The name is compared using "loose matching" as described in PropertyAliases.txt.

Rückgabewerte

Returns an IntlChar::PROPERTY_ constant value, or IntlChar::PROPERTY_INVALID_CODE if the given name does not match any property.

Beispiele

Beispiel #1 Testen unterschiedlicher Eigenschaften

<?php
var_dump
(IntlChar::getPropertyEnum('Bidi_Class') === IntlChar::PROPERTY_BIDI_CLASS);
var_dump(IntlChar::getPropertyEnum('script') === IntlChar::PROPERTY_SCRIPT);
var_dump(IntlChar::getPropertyEnum('IDEOGRAPHIC') === IntlChar::PROPERTY_IDEOGRAPHIC);
var_dump(IntlChar::getPropertyEnum('Some made-up string') === IntlChar::PROPERTY_INVALID_CODE);
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

bool(true)
bool(true)
bool(true)
bool(true)

Siehe auch