如何在PHP中将字符串转换为数组
问题描述:
如何在php中转换数组中的字符串,即
how to convert a string in array in php i.e
$str="this is string";
应该是这样
arr[0]=this
arr[1]=is
arr[2]=string
str_split($str, 3);
将字符串拆分为3个字符的单词,但我想在数组中的空格后转换字符串.
split the string in 3 character word but i want to convert the string after whitespace in an array.
答
$array = explode(' ', $string);