Help with splitting an array using array splice

Hi

I am new to php and was wondering if anybody could help me with splitting an array of sentences.

I want to divide the array into two parts, and then divide the first part again into 10 parts, and echo the results.

If I had 100 sentences it would look like this:

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

If there are not enough sentences then Part1, X to 10 should be blank.

Thanks

array_splice combines arrays, you’d need to use array_split or array_chunk. head over to php.net and look up the functions. they usually have some pretty decent examples on the bottom from other users.

Sponsor our Newsletter | Privacy Policy | Terms of Service