I am using the following snippet:
implode(' ', array_slice(explode(' ', $sentence), 0, 10));
The problem is that if there are two or 3 lines than it repeats the function and shows 10 words or etc per line.
How can i do it so it only selects the first 10 words from the first sentence and not repeat itself.
Make sure that
$sentenceonly contains the first line of whatever you’re feeding it, before it ever gets to this line of code.