略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: IntlChar::getPropertyEnum

2024-11-12

IntlChar::getPropertyEnum

(PHP 7, PHP 8)

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

说明

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().

参数

alias

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

返回值

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

范例

示例 #1 Testing different properties

<?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);
?>

以上例程会输出:

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

参见

add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/intlchar.getpropertyenum.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3