PHP: Hypertext Preprocessor (original) (raw)

Change language:

mb_scrub

(PHP 7 >= 7.2.0, PHP 8)

mb_scrub — Replace ill-formed byte sequences with the substitute character

Description

mb_scrub(string $string, ?string $encoding = [null](reserved.constants.php#constant.null)): string

Perform a character set conversion from the specified encoding, or the default encoding if no encoding was specified, to the same encoding. This has the effect of replacing any invalid byte sequences with the substitute character.

Parameters

string

The input string.

encoding

The encoding used to interpret string. If it is omitted or [null](reserved.constants.php#constant.null), thembstring.internal_encoding setting will be used if set, otherwise the default_charset setting will be used.

Return Values

The string result with invalid byte sequences replaced.

Changelog

Version Description
8.0.0 encoding is nullable now.

Found A Problem?

Learn How To Improve This PageSubmit a Pull RequestReport a Bug

+add a note

User Contributed Notes 1 note

up

down

24

Sammitch

7 years ago

`Replaces 'ill-formed' byte sequences with '?'.

See: https://github.com/php/php-src/pull/1099

`

+add a note