mb_encode_numericentity

FunctionParams and return types changed in PHP 8.0

Encode character to HTML numeric string reference.

PHP 5
PHP 7
PHP 8.0
Improved
PHP 8.1
PHP 8.2-8.3
PHP 8.4
PHP 8.5
PHP 8.6

mb_encode_numericentity Function synopsis

mb_encode_numericentity(
    string $string,
    array $map,
    ?string $encoding = null,
    bool $hex = false
  ): string

Parameters

$string

Typestring

The string being encoded.

$map

Typearray

$map is array specifies code area to convert.

$encoding

OptionalType?stringDefault valuenull

$hex

OptionalTypeboolDefault valuefalse

Whether the returned entity reference should be in hexadecimal notation (otherwise it is in decimal notation).

Return value

Typestring

The converted string.

Changes to the mb_encode_numericentity Function

PHP 8.0

  • Return type added: string
  • Parameter type added for parameter #1 ($string): string
  • Parameter name of parameter #2 changed: $convmap to $map
  • Parameter type added for parameter #2 ($map): array
  • Parameter type added for parameter #3 ($encoding): ?string
  • Parameter default value added for position #3 ($encoding): null
  • Parameter name of parameter #4 changed: $is_hex to $hex
  • Parameter type added for parameter #4 ($hex): bool
  • Parameter default value added for position #4 ($hex): false
  mb_encode_numericentity(
-     $string,
+     string $string,
-     $convmap,
+     array $map,
-     $encoding,
+     ?string $encoding = null,
-     $is_hex
+     bool $hex = false
-   )
+   ): string

PHP 5.4

  • Optional parameter added - #4: $is_hex
 mb_encode_numericentity(
     $string,
     $convmap,
-    $encoding
+    $encoding,
+    $is_hex
   )

mb_encode_numericentity Function Availability

PHP VersionAvailability
PHP 8.6Upcoming Release Yes
PHP 8.5Supported (Latest) Yes
PHP 8.4Supported Yes
PHP 8.3Security-Fixes Only Yes
PHP 8.2Security-Fixes Only Yes
PHP 8.1Unsupported Yes
PHP 8.0Unsupported Yes
PHP 7.4Unsupported Yes
PHP 7.3Unsupported Yes
PHP 7.2Unsupported Yes
PHP 7.1Unsupported Yes
PHP 7.0Unsupported Yes
PHP 5.6Unsupported Yes
PHP 5.5Unsupported Yes
PHP 5.4Unsupported Yes
PHP 5.3Unsupported Yes