PHP 8.4.0 RC4 available for testing

IntlChar::charType

(PHP 7, PHP 8)

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

Açıklama

public static IntlChar::charType(int|string $codepoint): ?int

Returns the general category value for the code point.

Bağımsız Değişkenler

codepoint

int türünde Unicode karakter kodu (örn. U+2603 SNOWMAN için 0x2603) veya string türünde Unicode karakter kodu (örn. "\u{2603}")

Örnekler

Örnek 1 Farklı karakter kodlarının denenmesi

<?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);
var_dump(IntlChar::charType("multiple chars") === null);
?>

Yukarıdaki örneğin çıktısı:

bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
add a note

User Contributed Notes

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