HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

mb_convert_kana

Description

The mb_convert_kana of Multibyte String for PHP convert "kana" one from another ("zen-kaku", "han-kaku" and more).

Syntax

mb_convert_kana(
    string $string,
    string $mode = "KV",
    ?string $encoding = null
): string

Parameters

string

The string being converted.

mode

The conversion option.

Specify with a combination of the following options:

OptionDescription
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

The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used.

Return

The converted string.

Examples

1 · string

<?

$string = "仮名";

$return = mb_convert_kana($string);

echo $return;
仮名

2 · mode

<?

$string = "仮名";
$mode = "KVC";

$return = mb_convert_kana($string, $mode);

echo $return;
仮名

3 · encoding

<?

$string = "仮名";
$mode = "KVC";
$encoding = "UTF-8";

$return = mb_convert_kana($string, $mode, $encoding);

echo $return;
仮名