IntlChar
PHP Manual

IntlChar::charType

(PHP 7)

IntlChar::charTypeGet the general category value for a code point

Descrição

public static int IntlChar::charType ( mixed $codepoint )

Returns the general category value for the code point.

Parâmetros

codepoint

Um codepoint integer (por exemplo 0x2603 para U+2603 SNOWMAN), ou um caracter codificado como uma string UTF-8 (exemplo "\u{2603}")

Valor Retornado

Returns the general category type, which may be one of the following constants:

Exemplos

Exemplo #1 Testando codepoints diferentes

<?php
var_dump
(IntlChar::charType("A") === IntlChar::CHAR_CATEGORY_UPPERCASE_LETTER);
var_dump(IntlChar::charType(".") === IntlChar::CHAR_CATEGORY_OTHER_PUNCTUATION);
var_dump(IntlChar::charType("\t") === IntlChar::CHAR_CATEGORY_CONTROL_CHAR);
var_dump(IntlChar::charType("\u{2603}") === IntlChar::CHAR_CATEGORY_OTHER_SYMBOL);
?>

O exemplo acima irá imprimir:

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

IntlChar
PHP Manual