PHP mb_convert_kana() Function Last Updated : 28 Sep, 2023 Comments Improve Suggest changes Like Article Like Report The mb_convert_kana() is an inbuilt function in PHP that is used to convert text into full-width and half-width. Syntax:mb_convert_kana($string, $mode, $encoding) : stringParameters: This function accepts three parameters that are described below. $string: This is the string that we want to convert using this function.$mode: This parameter specifies the different conversion options.$encoding: This parameter is optional. If you do not specify the encoding then It will use mb_internal_encoding() function encoding.Return Value: This mb_convert_kana() function returns the converted string. Program 1: The following program demonstrates the mb_convert_kana() function. PHP <?php // Input string $input = "Hello, world!"; // Convert to full-width form $converted = mb_convert_kana($input, "A", "UTF-8"); // Output the converted string echo $converted; ?> OutputHello, world! Program 2: The following program demonstrates the mb_convert_kana() function. PHP <?php // Input string $input = "12345"; $convertToFullWidth = true; // Conditionally convert the string to full-width form if ($convertToFullWidth) { $converted = mb_convert_kana($input, "N", "UTF-8"); } else { $converted = $input; } // Output the converted string echo $converted; ?> Output12345 Program 3: The following program demonstrates the mb_convert_kana() function. PHP <?php // Input array of strings $strings = ["Hello, world!", "こんにちは、世界!", "12345", "Geeks for Geeks"]; $convertToFullWidth = true; // Loop through the array and // conditionally convert the strings foreach ($strings as $string) { if ($convertToFullWidth) { $converted = mb_convert_kana($string, "A", "UTF-8"); } else { $converted = $string; } // Output the converted string echo $converted . "\n"; } ?> OutputHello, world! こんにちは、世界! 12345 Geeks for Geeks Reference: https://www.php.net/manual/en/function.mb-convert-kana.php Comment More infoAdvertise with us Next Article PHP mb_convert_kana() Function N neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-Multibyte-String Similar Reads PHP mb_convert_case() Function The mb_convert_case() function is an inbuilt function in PHP that is used to perform case folding on the string and converted it into the specified mode of string. Syntax: string mb_convert_case( string $string, int $mode, string $encoding = null ) Parameters: This function accepts three parameters 2 min read PHP mb_convert_encoding() Function The mb_convert_encoding() function is an inbuilt function in PHP that transforms the string into another character encoding. Syntax: mb_convert_encoding( array|string $string, string $to_encoding, array|string|null $from_encoding = null ): array|string|falseParameters: This function has 3 parameters 1 min read PHP mb_chr() Function The mb_chr() function is an inbuilt function in PHP that is used to return the character unicode point value that is encoded into the specified encoding. Syntax: string|false mb_chr(int $codepoint, string $encoding = null) Parameters: This function accepts two parameters that are described below: $c 1 min read PHP base_convert( ) Math Function The base_convert() function in PHP is used to convert a number given in an arbitrary base to a desired base. Both the base should be between 2 and 32 and bases with digits greater than 10 are represented with letters a-z i.e 10 is represented as a, 11 is represented as b and 35 is represented as z. 2 min read PHP mb_convert_variables() Function The mb_convert_variables() is an inbuilt function in PHP that transforms the character code into variables. Syntax: mb_convert_variables( $to_encoding, $from_encoding, $var, ...$vars ): string|falseParameters: This function accepts four parameters that are described below: $to_encoding: The characte 1 min read Like