我正在寻找类似的东西
str_split_whole_word($longString, $x)
where$longString
是句子的集合,$x
是每行的字符长度。它可能相当长,我想基本上以数组的形式将它分成多行。
例如:
$longString = 'I like apple. You like oranges. We like fruit. I like meat, also.';
$lines = str_split_whole_word($longString, $x);
期望的输出:
$lines = Array(
[0] = 'I like apple. You'
[1] = 'like oranges. We'
[2] = and so on...
)