I have an array. This an example:
$array = ['A', 'B', 'C', 'D']
I would like all possible combination to get the following result:
$new_array = [
['A', 'B'], ['A', 'C'], ['A', 'D'],
['A', 'B', 'C'], ['A', 'B', 'D'], ['A', 'C', 'D'],
['B', 'C'], ['B', 'D'],
['B', 'C', 'D']
['C', 'D']
['A', 'B', 'C', 'D']
]
So, as you can see, the result is a combination of array but they are all uniques. I mean ['A', 'B'] shoud be in the outpout but not ['B', 'A']. Also values in arrays should be sorted in alphanumeric order.
Unless I'm wrong, an array with 4 values gives 11 possibles and uniques combinations.
Thanks for your help.