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:
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"
.