I'm looking for something along the line of
str_split_whole_word($longString, $x)
Where $longString
is a collection of sentences, and $x
is the character length for each line. It can be fairly long, and I want to basically split it into multiple lines in the form of an array.
For example:
$longString = 'I like apple. You like oranges. We like fruit. I like meat, also.';
$lines = str_split_whole_word($longString, $x);
Desired output:
$lines = Array(
[0] = 'I like apple. You'
[1] = 'like oranges. We'
[2] = and so on...
)