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
)