array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'intlchar.totitle.php', 1 => 'IntlChar::totitle', ), 'up' => array ( 0 => 'class.intlchar.php', 1 => 'IntlChar', ), 'prev' => array ( 0 => 'intlchar.tolower.php', 1 => 'IntlChar::tolower', ), 'next' => array ( 0 => 'intlchar.toupper.php', 1 => 'IntlChar::toupper', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/intl/intlchar/totitle.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 7, PHP 8)
IntlChar::totitle — Make Unicode character titlecase
The given character is mapped to its titlecase equivalent. If the character has no titlecase equivalent, the original character itself is returned.
Returns the Simple_Titlecase_Mapping of the code point, if any;
otherwise the code point itself. Returns null
on failure.
示例 #1 Testing different code points
<?php
var_dump(IntlChar::totitle("DŽ"));
var_dump(IntlChar::totitle("dž"));
var_dump(IntlChar::totitle("Φ"));
var_dump(IntlChar::totitle("φ"));
var_dump(IntlChar::totitle("1"));
var_dump(IntlChar::totitle("ᾳ");
var_dump(IntlChar::totitle(ord("A")));
?>
以上示例会输出:
string(1) "Dž" string(1) "Dž" string(2) "Φ" string(2) "φ" string(1) "1" string(1) "ᾼ" int(65)