Splitting out all phrases in a string of words
Posted on 2011-09-11
I'm looking for some efficient php code to do the following:
Consider an input string of "one two three four" (any numer of words delimited by spaces).
I would like to output all possible combinations of phrases and words in that sentance e.g. :
one two three four
one two three
two three four
Would like to then put them in a string comma seperated (e.g. one two three four, one two three, one two, one, two three four,...)
Doesn't have to be in that order but any help on this much appreciated - driving me mad!