How to get all the possible combinations in the array of bits?

There is an array:
$arr = [0, 0, 0, 1, 1, 1]
How to get all possible combinations of rearranging the elements in some places?
June 14th 19 at 18:57
2 answers
June 14th 19 at 18:59
June 14th 19 at 19:01
For example, the algorithm Narayana Pandita, which at each iteration two elements varies between places. Implementation in JavaScript for example.

In your problem, given that it is not arbitrary arrays of strings, and bits, faster, probably in succession to cycle through the numbers 0 to 63 and count the bits included.

Find more questions by tags PHP