phrase split algorithm in PHP

Posted by Eric Sim on Stack Overflow See other posts from Stack Overflow or by Eric Sim
Published on 2010-05-07T07:55:39Z Indexed on 2010/05/07 7:58 UTC
Read the original article Hit count: 152

Filed under:

Not sure how to explain. Let's use an example. Say I want to split the sentence

"Today is a great day."

into

today
today is
today is a
today is a great
today is a great day
is
is a
is a great
is a great day
a
a great
a great day
great
great day
day

The idea is to get all the sequential combination in a sentence.

I have been thinking what's the best way to do it in PHP. Any idea is welcome.

© Stack Overflow or respective owner

Related posts about php