Current Location: Home> Function Categories> mb_decode_numericentity

mb_decode_numericentity

Decode into characters based on HTML numeric strings
Name:mb_decode_numericentity
Category:Multi-byte string
Programming Language:php
One-line Description:Convert HTML entity encoding to its corresponding characters

Function name: mb_decode_numericalentity()

Applicable version: PHP 4.0.6 and above

Function description: The mb_decode_numericalentity() function is used to convert HTML entity encoding into its corresponding characters. It can decode entity encodings using decimal or hexadecimal representations.

usage:

 string mb_decode_numericentity ( string $str , array $convmap [, string $encoding = mb_internal_encoding() ] )

Parameter description:

  • $str: A string that needs to be decoded.
  • $convmap: An array of two elements that specifies the mapping relationship between entity encoding and characters. The first element is the starting value of the entity encoding, and the second element is the Unicode value of the character.
  • $encoding: Optional parameter, specifying the character encoding to use. If not specified, internal character encoding is used.

Return value: The decoded string, if decoding fails, returns false.

Example:

 $str = "ABC"; $convmap = array(0x0, 0x10ffff, 0, 0xffff); $decodedStr = mb_decode_numericentity($str, $convmap, 'UTF-8'); echo $decodedStr; // 输出:ABC

In the example above, we use the mb_decode_numericalentity() function to convert the entity encoding into characters. We pass the string "ABC" to the function and use the $convmap array to specify the mapping relationship between the entity encoding and the characters. Finally, we output the decoded string to the screen, and the result is "ABC" .

Similar Functions
Popular Articles