Permutation and Combination in PhP
问题 I I want to compute the permutations 5p2, 5p3, 5p4 and 5p5 from the array [1,2,3,4,5] The function below only runs 5p5. To run 5p2, 5p3, 5p4 I will have to manually iterate through the array using a for...loop. Please help me. //function to return permutations 5p5 array function combinationArray($myarr) { $results = []; $current = []; $next = function($myarr) use(&$next,&$results,&$current) { $l = count($myarr); if($l === 1) { $current []= $myarr[0]; $results []= intval(implode($current)); /