preg_split vs mb_split

Viewed 2092

According to the PHP manual, the u modifier of PCRE regular expressions enables UTF-8 support for both the pattern and the subject string.

Considering this, is there any difference between using PCRE expressions with the u modifier and the corresponding mb_* multibyte string functions? (Assuming that all strings are UTF-8 encoded.)


As an example, consider preg_split vs mb_split: Both

preg_split('/' . $pattern . '/u', $string);

and

mb_split($pattern, $string);

seem to return identical results. So, which one should be preferred? Does it even matter?

2 Answers
Related