PHP mb_encode_numericentity() Function Last Updated : 28 Sep, 2023 Comments Improve Suggest changes Like Article Like Report The mb_encode_numericentity() function is an inbuilt function in PHP that is used to convert characters in a given string to their corresponding HTML numeric entity representations. Syntaxmb_encode_numericentity( string $string, array $map, ?string $encoding = null, bool $hex = false ): stringParameters This function accepts four parameters that are described below. $string: This parameter specifies the string that is to be decoded.$map: The code area that is to be transformed, is represented by the map, which is an array.hex: This parameter denotes either the entity reference will be hexadecimal notation or decimal notation.$encoding: The encoding parameter denotes the character encoding. If omitted or null, then the internal character encoding value will be used.Return Value The mb_encode_numericentity() function returns the encoded string if the function successfully executes otherwise. It will return false. Program 1: The following program demonstrates the mb_encode_numericentity() function. PHP <?php $input_string = "Bonjour tout le monde! Ça va bien ?"; // Check if the input string contains french characters if (preg_match("/[\x{00C0}-\x{02AF}]/u", $input_string)) { $convmap = [0x80, 0x10ffff, 0, 0x7fffffff]; // Encode characters from decimal // (hexadecimal 0x80 to 0x10FFFF) $encoded_string = mb_encode_numericentity( $input_string, $convmap, "UTF-8", true ); } else { $encoded_string = $input_string; } echo $encoded_string; ?> OutputBonjour tout le monde! Ça va bien ? Program 2: The following program demonstrates the mb_encode_numericentity() function. PHP <?php $input_string = "Hello, こんにちは!"; // Encode characters from decimal 128 to 65535 $convmap = [0x80, 0xffff, 0, 0xffff]; $encoded_string = mb_encode_numericentity($input_string, $convmap, "UTF-8"); echo $encoded_string; ?> Output: Hello, こんにちは! Reference: https://www.php.net/manual/en/function.mb-encode-numericentity.php Comment More infoAdvertise with us Next Article PHP mb_encode_numericentity() Function neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-Multibyte-String Similar Reads PHP mb_decode_numericentity() Function The mb_decode_numericentity() is an inbuilt function in PHP, where the reference for the numeric string in HTML will be decoded into characters. Syntax: mb_decode_numericentity(string $string, array $map, ?string $encoding = null): stringParameters: This function has four parameters: $string: This p 1 min read PHP | is_numeric() Function The is_numeric() function is an inbuilt function in PHP which is used to check whether a variable passed in function as a parameter is a number or a numeric string or not. The function returns a boolean value. Syntax: bool is_numeric ( $var ) Parameters: The function accepts a single parameter which 2 min read PHP | json_encode() Function The json_encode() function is an inbuilt function in PHP which is used to convert PHP array or object into JSON representation. Syntax : string json_encode( $value, $option, $depth ) Parameters: $value: It is a mandatory parameter which defines the value to be encoded. $option: It is optional parame 2 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 gmp_init() Function The gmp_init() function is an inbuilt function in PHP that is used to create a GMP number from different data types, including strings, integers, or other GMP objects. It's commonly used when you want to start performing arithmetic operations on large numbers without losing precision. Syntax: gmp_in 2 min read PHP htmlspecialchars_decode() Function The htmlspecialchars_decode() function is an inbuilt function in PHP that converts special entities back to characters. Syntax: Sttring htmlspecialchars_decode( string $string, int $flags = ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401 ) Parameters: This function accept two parameters that are discussed 1 min read 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 | IntlChar getNumericValue() Function The IntlChar::getNumericValue() function is an inbuilt function in PHP which is used to get the numeric value for a Unicode code point as defined in the Unicode Character Database. Syntax: float IntlChar::getNumericValue( $codepoint ) Parameters: This function accepts a single parameter $codepoint w 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 money_format() Function The money_format() function is an inbuilt function in PHP that returns a number formatted as a currency string. In the main string, the formatted number is inserted where there is a percentage sign (%). The function is only defined in systems with strfmon() capacities. For example, money_format() is 4 min read Like