Open In App

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): string

Parameters:  This function has four parameters:

Return Values: The function return decoded string.



Example 1: The following code demonstrates the mb_decode_numericentity() function.




<?php
  
// Define a string with numeric entities
$str = 'ABC';
  
// Decode the string
$decoded_str = mb_decode_numericentity(
    $str, array(0x0, 0x10000, 0, 0xfffff), 'UTF-8');
  
// Display the decoded string
echo $decoded_str;
?>

Output:

ABC

Example 2: The following code demonstrates the mb_decode_numericentity() function.




<?php
  
// Define a string with numeric entities
$str = 'Hello World';
  
// Decode the string
$decoded_str = mb_decode_numericentity(
    $str, array(0x0, 0x10000, 0, 0xfffff), 'UTF-8');
  
// Display the decoded string
echo $decoded_str;
?>

Output:

Hello World

Reference: https://www.php.net/manual/en/function.mb-decode-numericentity.php#refsect1-function.mb-decode-numericentity-description


Article Tags :