【发布时间】:2011-05-30 07:04:49
【问题描述】:
$str = "Hello fri3nd, you're looking good today! What a Great day this is! How fancy and cool!";
$pieces = explode(" ",$str, 3);
print_r($pieces);
所以这给了我$pieces[0] = 'Hello',$pieces[1] = 'fri3nd'... and the rest of the string is all shoved into$pieces[3]`。我怎样才能爆炸成每 3 或 4 个单词?
【问题讨论】:
-
在你的标题中,你问的是相等的部分,在问题中,你问的是每 3 或 4 个单词。它是哪一个,您希望它如何准确地工作?
-
你能解释一下你的要求和情况吗?为什么要用 3 或 4 个单词来分割?如果您能解释您的要求,我们可能会提出最佳解决方案。