Php 将数组拆分为数组的数组

Php 将数组拆分为数组的数组,php,Php,我有一个字符串数组,这些字符串是句子,我需要将其拆分为多个单词数组。我尝试使用数组块,但我必须做两次才能得到我想要的,而且我无法访问分割数组的每个单独元素来再次使用数组块 对不起,如果它混淆了基本上我想要的是 $arr="this is a", "sentence and", "this is stackoverflow" 分为: $arr1="this", "is", "a" $arr2="sentence", "and" $arr3="this", "is", "stackoverflow

我有一个字符串数组,这些字符串是句子,我需要将其拆分为多个单词数组。我尝试使用数组块,但我必须做两次才能得到我想要的,而且我无法访问分割数组的每个单独元素来再次使用数组块

对不起,如果它混淆了基本上我想要的是

$arr="this is a", "sentence and", "this is stackoverflow"
分为:

$arr1="this", "is", "a"
$arr2="sentence", "and"
$arr3="this", "is", "stackoverflow"
这就是我尝试过的

$chunk=(array_chunk($userinf,1));
//$chunks=(array_chunk($chunk,1));
//print_r($chunks);
for( $i=0;$i<count($chunks);$i++ ){
do something
}
$chunk=(数组_chunk($userinf,1));
//$chunks=(数组_chunk($chunk,1));
//打印(块);

对于($i=0;$i),只需遍历现有数组并将值重新分配为新数组

$arr = ["this is a", "sentence and", "this is stackoverflow"];

foreach ($arr as $key => $val) {

    $arr[$key] = explode(" ", $val);

}
结果是

$arr = [["this","is","a"],["sentence","and"],["this","is","stackoverflow"]]

我将如何访问每个元素?就像我使用