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

Description

Since PHP 8.2, several encodings were dropped from mbstring, including html.

This is a deprecation, so the feature is available until PHP 9.

Example

<?php

mb_convert_encoding('foo', 'html');

?>

Alternatives

  • It is recommended to use the htmlspecialchars(), htmlentities(), mb_encode_numericentity(), mb_decode_numericentity() functions to do this.

Changed Behavior

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