php有什么简单的方法可以用1-3个词来爆炸句子吗?
$str = 'Wikipedia was launched on January 15, 2001.';
$str = preg_replace('/[[:punct:]]/i',' ',$str);
$parts = explode(' ',trim($str));
现在我想说出这样的话。谢谢。
$output_array={
"Wikipedia",
"was",
"launched",
"on",
"January",
"15",
"2001", //one word
"Wikipedia was",
"launched on",
"January 15",
"was launched",
"on January",
"15 2001", //two nearby words.
"Wikipedia was launched",
"on January 15",
"was launched on",
"January 15 2001",
"launched on January",
"on January 15" //three nearby words.
}