在线文档教程
PHP

mb_convert_kana

mb_convert_kana

(PHP 4 >= 4.0.6, PHP 5, PHP 7)

mb_convert_kana - 将“假名”换成另一个(“禅学”,“汉卡”等)

描述

string mb_convert_kana ( string $str [, string $option = "KV" [, string $encoding = mb_internal_encoding() ]] )

对字符串执行“汉卡库” - “禅卡”转换str。这个功能只对日文有用。

参数

str

正在转换的字符串。

option

转换选项。

指定以下选项的组合。

OptionMeaning
rConvert "zen-kaku" alphabets to "han-kaku"
RConvert "han-kaku" alphabets to "zen-kaku"
nConvert "zen-kaku" numbers to "han-kaku"
NConvert "han-kaku" numbers to "zen-kaku"
aConvert "zen-kaku" alphabets and numbers to "han-kaku"
AConvert "han-kaku" alphabets and numbers to "zen-kaku" (Characters included in "a", "A" options are U+0021 - U+007E excluding U+0022, U+0027, U+005C, U+007E)
sConvert "zen-kaku" space to "han-kaku" (U+3000 -> U+0020)
SConvert "han-kaku" space to "zen-kaku" (U+0020 -> U+3000)
kConvert "zen-kaku kata-kana" to "han-kaku kata-kana"
KConvert "han-kaku kata-kana" to "zen-kaku kata-kana"
hConvert "zen-kaku hira-gana" to "han-kaku kata-kana"
HConvert "han-kaku kata-kana" to "zen-kaku hira-gana"
cConvert "zen-kaku kata-kana" to "zen-kaku hira-gana"
CConvert "zen-kaku hira-gana" to "zen-kaku kata-kana"
VCollapse voiced sound notation and convert them into a character. Use with "K","H"

encoding

encoding参数是字符编码。如果省略,则使用内部字符编码值。

返回值

转换后的字符串。

例子

示例#1 mb_convert_kana()示例

<?php /* Convert all "kana" to "zen-kaku" "kata-kana" */ $str = mb_convert_kana($str, "KVC" /* Convert "han-kaku" "kata-kana" to "zen-kaku" "kata-kana"     and "zen-kaku" alpha-numeric to "han-kaku" */ $str = mb_convert_kana($str, "KVa" ?>

← mb_convert_encoding

mb_convert_variables →