【发布时间】:2012-06-29 00:44:08
【问题描述】:
我正在寻找类似的东西
str_split_whole_word($longString, $x)
其中$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...
)
【问题讨论】:
标签: php arrays regex string split