hi all
i have two arrays. called $words and $sentence
the $ words array holds individual split words e.g.
one
two
three
four
etc
i want to be able to pick out X number of words from the $word array and stick it into the appropriate location in $sentence array
so e.g. lets say we set $x = 6 (six words per sentence)
assuming there are only 24 entries in the word array we know there will be 4 sentences
so by doing
for ($i=0;$i<=$x;$i++) {
$sentence[$i]."br /";
} // end for
it should output as follows
one two three four five six // sentence 0
seven eight nine ten eleven // sentence 1
twelve thirteen fourteen fifteen // sentence 2
sixteen seventeen eighteen nineteen // sentence 3
twenty one twenty two twenty three twenty four // sentence 4
can someone help me by showing how i can get x number of words from word array into the sentence array as shown?
it should be such that i can specify the number of words per sentence.
thanks very much