mb_convert_kana

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

mb_convert_kanaConvert "kana" one from another ("zen-kaku", "han-kaku" and more)

说明

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

Performs a "han-kaku" - "zen-kaku" conversion for string str. This function is only useful for Japanese.

参数

str

The string being converted.

option

The conversion option.

Specify with a combination of following options.

Applicable Conversion Options
Option Meaning
r Convert "zen-kaku" alphabets to "han-kaku"
R Convert "han-kaku" alphabets to "zen-kaku"
n Convert "zen-kaku" numbers to "han-kaku"
N Convert "han-kaku" numbers to "zen-kaku"
a Convert "zen-kaku" alphabets and numbers to "han-kaku"
A Convert "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)
s Convert "zen-kaku" space to "han-kaku" (U+3000 -> U+0020)
S Convert "han-kaku" space to "zen-kaku" (U+0020 -> U+3000)
k Convert "zen-kaku kata-kana" to "han-kaku kata-kana"
K Convert "han-kaku kata-kana" to "zen-kaku kata-kana"
h Convert "zen-kaku hira-gana" to "han-kaku kata-kana"
H Convert "han-kaku kata-kana" to "zen-kaku hira-gana"
c Convert "zen-kaku kata-kana" to "zen-kaku hira-gana"
C Convert "zen-kaku hira-gana" to "zen-kaku kata-kana"
V Collapse voiced sound notation and convert them into a character. Use with "K","H"

encoding

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

返回值

The converted string.

范例

Example #1 mb_convert_kana() example

<?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");
?>

相关文章
php expect 函数 waits until the output from a process matches one of the patterns a specified time period has passed or an eof is seenphp 多字节字符串 函数 检查字符串在指定的编码里是否有效php 多字节字符串 函数 convert kana one from another zen kaku han kaku and more php 多字节字符串 函数 perform a regular expression search and replace with multibyte support using a callbackphp 多字节字符串 函数 replace regular expression with multibyte supportphp 多字节字符串 函数 returns start point for next regular expression matchphp 多字节字符串 函数 retrieve the result from the last multibyte regular expression matchphp 多字节字符串 函数 设置/获取当前的语言php 多字节字符串 函数 返回所有支持编码的数组php 多字节字符串 函数 查找字符串在另一个字符串中首次出现的位置php 多字节字符串 函数 查找指定字符在另一个字符串中最后一次的出现php pdf 函数 convert string from utf 32 to utf 16php pdf 函数 convert string from utf 8 to utf 16php 杂项 函数 convert string from one codepage to anotherphp stream 函数 copies data from one stream to anotherphp com 函数 convert a variant into a new variant object of another typephp 多字节字符串 多字节字符串 函数php sam 函数 read one or more messages from a queue without removing it from the queuephp uconverter convert string from one charset to anotherphp uconverter convert string from one charset to another
关注编程学问公众号