我在尋找沿PHP:沒有打破的話分割的長字符串
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...
)
Marcio,謝謝你的幫助。這有助於你的描述! – musicliftsme
@ user796837,Nevermind,很高興爲您效勞! –