mb_regex_set_options()

mb_regex_set_options() — Set/Get the default options for mbregex functions.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

What it does

Sets the default options described by options for multibyte regex functions.

Signature

mb_regex_set_options(?string $options = null): string

Parameters

ParameterTypeWhat it takes
$options?stringThe options to set. This is a string where each character is an option. To set a mode, the mode character must be the last one set, however there can only be set one mode but multiple options.

Return value

The previous options. If options is omitted or null, it returns the string that describes the current options.

Example

The PHP manual ships no example for mb_regex_set_options(); the signature and the parameter table above are the contract.

Changelog

VersionChange
8.0.0If the parameter options is given and not null, the previous options are returned. Formerly, the current options have been returned.
8.0.0options is nullable now.
8.0.0The "e" option now throws a ValueError.
7.1.0The "e" option now emits an E_DEPRECATED.

See also

mb_split(), mb_ereg(), mb_eregi()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page mb_regex_set_options() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.