PHP mb_convert_encoding() Function Last Updated : 28 Mar, 2023 Comments Improve Suggest changes Like Article Like Report 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: string: The parameter specifies the string or array that is to be converted.to_encoding: This parameter specifies the desired encoding for the result.from_encoding: If mbstring.internal_encoding setting will be utilized, if from_encoding is null or not specified, otherwise the default_charset setting will be used.Return Value: This function returns an encoded string if the function is successfully executed otherwise it will return false. Example 1: The following code demonstrates the mb_convert_encoding() function. PHP <?php // UTF-8 string to be converted to ASCII $string = "Café au lait"; // Convert UTF-8 string to ASCII $ascii_string = mb_convert_encoding($string, "ASCII"); // Output the converted string echo $ascii_string; ?> Output: Caf? au lait Example 2: The following code demonstrates the mb_convert_encoding() function. PHP <?php // ISO-8859-1 string to be converted to UTF-8 $string = "Björk"; // Convert ISO-8859-1 string to UTF-8 $utf8_string = mb_convert_encoding( $string, "UTF-8", "ISO-8859-1"); // Output the converted string echo $utf8_string; ?> Output: Björk Reference: https://www.php.net/manual/en/function.mb-convert-encoding.php Comment More infoAdvertise with us Next Article PHP mb_convert_encoding() Function N neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-Multibyte-String Similar Reads PHP mb_check_encoding() Function The mb_check_encoding() function is an inbuilt function in PHP that is used to check whether a given string is valid for specified encoding or not. Syntax: bool mb_check_encoding( array|string|null $value = null, string $encoding = null ) Parameters: This function accepts two parameters that are des 2 min read PHP mb_detect_encoding() Function The mb_detect_encoding() is an inbuilt function in PHP that is used to detect the encoding of the string. Syntax: string|false mb_detect_encoding( string $string, array|string|null $encodings = null, bool $strict = false ) Parameters: This function accepts three parameters that are described below. 2 min read PHP mb_encoding_aliases() Function The mb_encoding_aliases() is an inbuilt PHP function that can be utilized to retrieve aliases for a known encoding type. Syntax: mb_encoding_aliases(string $encoding): array Parameter: This function has only one parameter: encoding: This parameter specifies the encoding type that is to be checked fo 1 min read PHP mb_convert_kana() Function 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 2 min read 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 Like