在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
)