php str_split函数用于将字符串分割成数组,每个数组元素包含一个字符。其语法为:
str_split(string $string, int $split_length = 1) : array
参数说明:
示例:
$str = "Hello";
$arr = str_split($str);
print_r($arr);
输出结果为:
Array
(
[0] => H
[1] => e
[2] => l
[3] => l
[4] => o
)