mb_decode_numericentity()
mb_decode_numericentity() — Decode HTML numeric string reference to character.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
Convert numeric string reference of string string in a specified block to character.
Signature
mb_decode_numericentity(string $string, array $map, ?string $encoding = null): string
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $string | string | The string being decoded. |
| $map | array | map is an array that specifies the code area to convert. |
| $encoding | ?string | The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. |
Return value
The converted string.
Example
A runnable snippet:
$convmap = array( int start_code1, int end_code1, int offset1, int mask1, int start_code2, int end_code2, int offset2, int mask2, // ........ int start_codeN, int end_codeN, int offsetN, int maskN ); // Specify Unicode value for start_codeN and end_codeN // Add offsetN to value and take bit-wise 'AND' with maskN, // then convert value to numeric string reference.
Changelog
| Version | Change |
|---|---|
| 8.4.0 | The mb_decode_numericentity() function now throws a ValueError if map contains any value that cannot be implicitly converted to int. |
| 8.0.0 | encoding is nullable now. |
| 8.0.0 | Now throws a ValueError if encoding is an invalid encoding. Previously, an E_WARNING was emitted and false was returned. |
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page mb_decode_numericentity() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.