可以使用str_split()函數將一個字符串轉換為數組。該函數將字符串按照指定的長度拆分為一個數組。例如:
$str = "Hello World";
$arr = str_split($str);
print_r($arr);
輸出結果為:
Array
(
[0] => H
[1] => e
[2] => l
[3] => l
[4] => o
[5] =>
[6] => W
[7] => o
[8] => r
[9] => l
[10] => d
)