可以使用explode()函数将字符串转化为数组,该函数以指定的分隔符为界将字符串分割成数组。

例如,将逗号分隔的字符串转化为数组:

$str = "apple,banana,orange";
$array = explode(",", $str);
print_r($array);

输出结果:

Array
(
    [0] => apple
    [1] => banana
    [2] => orange
)
php怎么把字符串转化成数组

原文地址: https://www.cveoy.top/t/topic/bCuA 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录