2012-04-03 119 views
0

我是新來的PHP,想知道是否有人可以幫我分裂一堆句子。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應該是空白。

感謝

+0

你能告訴我們你的句子的陣列?不同的語言和不同的寫作風格可能意味着不同的方式分裂成文字:) – F21 2012-04-03 08:54:31

回答

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