IntlChar::totitle

(PHP 7, PHP 8)

IntlChar::totitleMake Unicode character titlecase

説明

public static IntlChar::totitle(mixed $codepoint): mixed

The given character is mapped to its titlecase equivalent. If the character has no titlecase equivalent, the original character itself is returned.

パラメータ

codepoint

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

返り値

Returns the Simple_Titlecase_Mapping of the code point, if any; otherwise the code point itself.

戻り値の型は int になります。ただし、コードポイントを UTF-8 文字列で渡した場合は別で、その場合の返り値の型は文字列になります。

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

<?php
var_dump
(IntlChar::totitle("A"));
var_dump(IntlChar::totitle("a"));
var_dump(IntlChar::totitle("Φ"));
var_dump(IntlChar::totitle("φ"));
var_dump(IntlChar::totitle("1"));
var_dump(IntlChar::totitle(ord("A")));
var_dump(IntlChar::totitle(ord("a")));
?>

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

string(1) "A"
string(1) "A"
string(2) "Φ"
string(2) "Φ"
string(1) "1"
int(65)
int(65)

参考

add a note add a note

User Contributed Notes

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