PHP mb_check_encoding() Function Last Updated : 31 Aug, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 described below: $value: This parameter accepts the byte stream or array to check. If this value is null then it checks for all input from the beginning to the request.$encoding: This parameter accepts the expected encoding. Return Value: This function returns "true" on success and "false" on Failure. Note: The value of $value and $encoding parameters are null in version 8.0.0.This function now accepts an array of values and formally it accepts only string values. Example 1: The following code demonstrates the PHP mb_check_encoding() method. PHP <?php // Declare a variable and assign // string value $str = "Welcome to GeeksforGeeks"; // Check string for specified encoding $bool = mb_check_encoding($str, "ASCII"); // Returns true means string is // valid for specified encoding var_dump($bool); ?> Outputbool(true) Example 2: The following code demonstrates another example for the PHP mb_check_encoding() method. PHP <?php // Declare a variable and assign // string value $str = "Welcome to GeeksforGeeks"; // Check string for base64 encoding $bool = mb_check_encoding($str, "base64"); // Returns true means string is // valid for specified encoding var_dump($bool); ?> Outputbool(false) Reference: https://www.php.net/manual/en/function.mb-check-encoding.php Comment More infoAdvertise with us Next Article PHP | iconv_get_encoding() Function V vkash8574 Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads 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_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_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_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 | iconv_get_encoding() Function The iconv_get_encoding() function is an inbuilt function in PHP which is used to retrieve the internal configuration variables of iconv extension. Syntax: mixed iconv_get_encoding( $type = "all" ) Parameters: This function accepts single parameter $type. The value of $type parameter are: all input_e 1 min read PHP | base64_encode() Function The base64_encode() function is an inbuilt function in PHP that is used to encode data with MIME base64. MIME (Multipurpose Internet Mail Extensions) base64 is used to encode the string in base64. The base64_encoded data takes 33% more space than the original data. Syntax: string base64_encode( $dat 1 min read Like