## Why does duplications happen in Heap's algorithm

I want to get all permutations from elements of array. Source array is very simple:
$arr = [ 1,2,3,4 ];
I wrote the code for implement Heap's algorithm,
private function mixture( $size, array $collection ) {
$permutations = [];
$offset =...

more
»