Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | function str_split_unicode(string $string, int $max_length = 200) : array |
||
12 | { |
||
13 | if ($max_length > 0) { |
||
14 | $result = []; |
||
15 | $char_length = mb_strlen($string, "UTF-8"); |
||
16 | |||
17 | for ($part = 0; $part < $char_length; $part += $max_length) { |
||
18 | array_push($result, mb_substr($string, $part, $max_length, "UTF-8")); |
||
19 | } |
||
20 | |||
21 | return $result; |
||
22 | } |
||
23 | |||
24 | return preg_split("//u", $string, -1, PREG_SPLIT_NO_EMPTY); |
||
|
|||
25 | } |
||
39 | } |