我有一个字符串。
$string = "this is my string";
所以我想引爆它。
$explode = explode(' ', $string);
现在我想知道是否可以将每个单词插入到一个数组中,这样我就可以得到这个。
$array = array('this', 'is', 'my', 'string');
$array = array();
$string = "this is my string";
$explode = explode(' ', $string);
for ($i=0; $i<count($explode); $i++) {
array_push($array, $explode[$i]);
}
print_r ($array);
正如Frayne Konok所说,$explode
是类似于$array
的数组。爆炸函数已经做到了。