mb_split()

mb_split() — Split multibyte string using regular expression.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.2.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

Split a multibyte string using regular expression pattern and returns the result as an array.

Signature

mb_split(string $pattern, string $string, int $limit = -1): array|false

Parameters

ParameterTypeWhat it takes
$patternstringThe regular expression pattern.
$stringstringThe string being split.
$limitintIf optional parameter limit is specified, it will be split in limit elements as maximum.

Return value

The result as an array, or false on failure.

Example

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

See also

mb_regex_encoding(), mb_ereg(), explode()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page mb_split() (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.