mb_convert_kana

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

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

Description

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

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

Parameters

string

The string being converted.

mode

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

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

Return Values

The converted string.

Changelog

Version Description
8.0.0 encoding is nullable now.

Examples

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" alphanumeric to "han-kaku" */
$str mb_convert_kana($str"KVa");
?>

Here you can write a comment


Please enter at least 10 characters.
Loading... Please wait.
* Pflichtangabe
There are no comments available yet.

PHP cURL Tutorial: Using cURL to Make HTTP Requests

cURL is a powerful PHP extension that allows you to communicate with different servers using various protocols, including HTTP, HTTPS, FTP, and more. ...

TheMax

Autor : TheMax
Category: PHP-Tutorials

Midjourney Tutorial - Instructions for beginners

There is an informative video about Midjourney, the tool for creating digital images using artificial intelligence, entitled "Midjourney tutorial in German - instructions for beginners" ...

Mike94

Autor : Mike94
Category: KI Tutorials

Basics of views in MySQL

Views in a MySQL database offer the option of creating a virtual table based on the result of an SQL query. This virtual table can be queried like a normal table without changing the underlying data. ...

admin

Autor : admin
Category: mySQL-Tutorials

Publish a tutorial

Share your knowledge with other developers worldwide

Share your knowledge with other developers worldwide

You are a professional in your field and want to share your knowledge, then sign up now and share it with our PHP community

learn more

Publish a tutorial