<?php function uniqueCombination($in, $minLength = 1, $max = 2000) { $count = count($in); $members = pow(2, $count); $return = array(); for($i = 0; $i < $members; $i ++) { $b = sprintf("%0" . $count . "b", $i); $out = array(); for($j = 0; $j < $count; $j ++) { $b{$j} == '1' and $out[] = $in[$j]; } count($out) >= $minLength && count($out) <= $max and $return[] = $out; } return $return; } $numbers = array(1,2,3); $return = uniqueCombination($numbers); sort($return); print_r(array_map(function($v){ return implode(" ", $v); }, $return)); ?>
You have javascript disabled. You will not be able to edit any code.
There are `0` results