在PHP中,可以使用str_split()
函數將字符串轉換為數組。示例如下:
$string = "Hello World";
$array = str_split($string);
print_r($array);
輸出結果為:
Array
(
[0] => H
[1] => e
[2] => l
[3] => l
[4] => o
[5] =>
[6] => W
[7] => o
[8] => r
[9] => l
[10] => d
)