CakeFest 2024: The Official CakePHP Conference

IntlChar::getBlockCode

(PHP 7, PHP 8)

IntlChar::getBlockCodeコードポイントが含まれる割当ブロックを取得する

説明

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

コードポイントが含まれる Unicode の割当ブロックを返します。

パラメータ

codepoint

コードポイントを表す int 型の値 (例: U+2603 SNOWMAN を表す 0x2603)、あるいは UTF-8 文字列としてエンコードされた文字 (例: "\u{2603}")。

戻り値

codepoint のブロックの値を返します。 返されうる値については 定数 IntlChar::BLOCK_CODE_* を参照ください。 失敗した場合は、null を返します。

例1 さまざまなコードポイントの例

<?php
var_dump
(IntlChar::getBlockCode("A") === IntlChar::BLOCK_CODE_BASIC_LATIN);
var_dump(IntlChar::getBlockCode("Φ") === IntlChar::BLOCK_CODE_GREEK);
var_dump(IntlChar::getBlockCode("\u{2603}") === IntlChar::BLOCK_CODE_MISCELLANEOUS_SYMBOLS);
?>

上の例の出力は以下となります。

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

User Contributed Notes

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