首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

IntlChar::getPropertyEnum

(PHP 7)

IntlChar::getPropertyEnum — Get the property constant value for a given property name

Description

代码语言:javascript
复制
public static int IntlChar::getPropertyEnum ( string $alias )

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 compliments IntlChar::getPropertyName().

Parameters

alias

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

Return Values

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

Examples

Example #1 Testing different properties

代码语言:javascript
复制
<?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);
?>

The above example will output:

代码语言:javascript
复制
bool(true)
bool(true)
bool(true)
bool(true)

See Also

  • IntlChar::getPropertyName() - Get the Unicode name for a property

← IntlChar::getNumericValue

IntlChar::getPropertyName →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com