|
| |
1 |
|
<?php |
|
| |
2 |
|
|
|
| |
3 |
|
|
|
| |
4 |
|
|
|
| |
5 |
|
|
|
| |
6 |
|
|
|
| |
7 |
|
|
|
| |
8 |
|
|
|
| |
9 |
|
|
|
| |
10 |
|
|
|
| |
11 |
|
|
|
| |
12 |
|
|
|
| |
13 |
|
|
|
| |
14 |
|
|
|
| |
15 |
|
|
|
| |
16 |
|
|
|
| |
17 |
|
|
|
| |
18 |
|
|
|
| |
19 |
|
|
|
| |
20 |
|
|
|
| |
21 |
|
|
|
| |
22 |
|
|
|
| |
23 |
|
|
|
| |
24 |
|
|
|
| |
25 |
|
|
|
| |
26 |
|
|
|
| |
27 |
|
|
|
| |
28 |
|
|
|
| |
29 |
|
|
|
| |
30 |
|
|
|
| |
31 |
|
|
|
| |
32 |
|
|
|
| |
33 |
|
|
|
| |
34 |
|
if (!function_exists('str_split')) |
|
| |
35 |
|
{ |
|
| |
36 |
|
function str_split ($string, $split_length = 1) |
|
| |
37 |
|
{ |
|
| |
38 |
|
if (!is_numeric($split_length)) { |
|
| |
39 |
|
trigger_error('str_split() expects parameter 2 to be long, ' . gettype($split_length) . ' given', E_USER_WARNING); |
|
| |
40 |
|
return false; |
|
| |
41 |
|
} |
|
| |
42 |
|
|
|
| |
43 |
|
if ($split_length < 1) { |
|
| |
44 |
|
trigger_error('str_split() The the length of each segment must be greater then zero', E_USER_WARNING); |
|
| |
45 |
|
return false; |
|
| |
46 |
|
} |
|
| |
47 |
|
|
|
| |
48 |
|
preg_match_all('/.{1,' . $split_length . '}/s', $string, $matches); |
|
| |
49 |
|
return $matches[0]; |
|
| |
50 |
|
} |
|
| |
51 |
|
} |
|
| |
52 |
|
|
|
| |
53 |
|
?> |