TURNS OUT THAT MY MATH OPERATION WAS THE WRONG ONE! READ PHP array combinations FOR AN EXAMPLE OF COMBINATION
I Am searching the Web now for 3 weeks ( including SO) i dont find someone who has already asked or solved it.
I need a Permutation of an Array in PHP of only uniq ordered values.
$array = array('Number1', 'Number2', 'Number3', 'Number4', 'Number5', 'Number6');
usually a permutation will be like
.1 Number1, Number2, Number3, ...;
.2 Number1, Number2, Number4, ...;
.3 Number2, Number4, Number1, ...;
But i need it ordered and uniq. so the 3rd line would be ordered to
.1 Number1, Number2, Number3, ...;
.2 Number1, Number2, Number4, ...;
.3 Number1, Number2, Number4, ...;
And that means Row 3 is NOT uniq and will not be saved in a new array.
2nd Example
is wrong for mearray('A','B','C')
A
AB
AC
ABC
ACB
B
BC
BA
BCA
BAC
C
CA
CB
CAB
CBA
I need the output like this
A
B
C
AB
BC
AC
ABC
I kinda solved it so far. BUT my solution is like stoneage and just sorts all new array_permutations and array_filter them. thats like 100 Years calculation time cause 6 numbers permutated with all possabilitys is like X^10 -.-
Please help me guys.
btw: its my first post here, so be gentle :D