Php阵列拼接


Php array splice

我是php的新手,想知道是否有人能帮我拆分一组句子。

我想把数组分成两部分,然后把第一部分再次分成10部分,并对结果进行回声处理。

如果我有100句话,它会是这样的:

echo $Part1-1;  // 5 Sentences
echo $Part1-2;  // 5 Sentences
echo $Part1-3;  // 5 Sentences
echo $Part1-4;  // 5 Sentences
echo $Part1-5;  // 5 Sentences
echo $Part1-6;  // 5 Sentences
echo $Part1-7;  // 5 Sentences
echo $Part1-8;  // 5 Sentences
echo $Part1-9;  // 5 Sentences
echo $Part1-10; // 5 Sentences
echo $Part2; // 50 Sentences

如果没有足够的句子,那么第1部分,X到10部分应该是空白的。

感谢

$outerParts = array_chunk($sentences, 50);
$innerParts1 = array_chunk($outerParts[0], 5);