让我们说我有一个字符串:
$string = "This is my test case for an example."
Run Code Online (Sandbox Code Playgroud)
如果我根据''得到一个爆炸而爆炸
Array('This','is','my','test','case','for','an','example.');
Run Code Online (Sandbox Code Playgroud)
我想要的是每隔一个空间爆炸:
Array('This is','my test','case for','an example.').
Run Code Online (Sandbox Code Playgroud)
字符串可能有一些奇数字,因此数组中的最后一项可能不包含两个单词.
有人知道怎么做吗?