使用正規表示式分割多位元組字串

mb_split

(PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8)

mb_split使用正規表示式分割多位元組字串

說明

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

使用正規表示式 pattern 分割多位元組 string 並返回結果 array

參數

pattern

正規表示式。

string

待分割的 string

limit
如果指定了可選參數 limit,將最多分割為 limit 個元素。

返回值

array 的結果。

註釋

注意:

The character encoding specified by mb_regex_encoding() will be used as the character encoding for this function by default.

參見

Leave a Reply

Your email address will not be published. Required fields are marked *