SE is returned if split_length is less than 1. If the split_length length exceeds the length of string, the entire string is returned as the first (and only) array element.
例 1. Example uses of str_split()
复制代码 代码如下:
<?php
$str = "Hello Friend";
$arr1 = str_split($str);
$arr2 = str_split($str, 3);
print_r($arr1);
print_r($arr2);
?>
Output may look like:
复制代码 代码如下:
Array
(
[0] => H
=> e
=> l
=> l
=> o
=>
=> F
=> r
=> i
=> e
[10] => n
[11] => d
)
Array
(
[0] => Hel
=> lo
=> Fri
=> end
)