Possible Duplicate:
algorithm that will take numbers or words and find all possible combinations
Combinations, Dispositions and Permutations in PHP
I've read/tried alot of the suggested answers on SO, which none of them solves the problem
$array = array('Alpha', 'Beta', 'Gamma');
How to get all possible combinations?
Expected output:
array('Alpha',
'Beta',
'Gamma',
'Alpha Beta',
'Alpha Gamma',
'Beta Alpha',
'Beta Gamma',
'Gamma Alpha',
'Gamma Beta',
'Alpha Beta Gamma',
'Alpha Gamma Beta',
'Beta Alpha Gamma',
'Beta Gamma Alpha',
'Gamma Alpha Beta',
'Gamma Beta Alpha')
Note: The answer I'm looking for should include all combinations and all different arrangements. For example: 'Alpha Beta' and 'Beta Alpha' are 2 different strings and both should be in the output array.
Thanks in advance