Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Handling HTML entities via mbstring is deprecated; use htmlspecialchars, htmlentities, or mb_encode_numericentity/mb_decode_numericentity instead

Description

Since PHP 8.2, several pseudo-encodings were dropped from mbstring, including HTML-ENTITIES, which converted characters to and from their HTML numeric/named entity representation.

This functionality overlapped with dedicated, better-maintained functions, and its removal simplifies the mbstring encoding conversion tables. It remains usable until PHP 9, when it will be removed entirely.

Example

<?php

mb_convert_encoding('foo', 'HTML-ENTITIES');

?>

Alternatives

  • Use htmlspecialchars() or htmlentities() to encode text as HTML entities.
  • Use mb_encode_numericentity()/mb_decode_numericentity() for numeric entity conversion.

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See mb_convert_encoding