Disclaimer: Auto generated file.
Please help us setting parameters to useful values and extending the examples.
- Permutation::permutationsCount(int $numberOfElements, int $numberInPermutation = null) : int
/**
* Number of permuations for \$numberOfElements in groups of \$numberInPermutation length
*
* @param int \$numberOfElements
* @param int \$numberInPermutation
* @return int number of permutations, 0 in imposible permutations
*/ - Permutation::permutationsCount(3); -> 6
- Permutation::permutations(array $set, $numberInPermutation = null) :
/**
* Permuations for \$numberOfElements in groups of \$numberInPermutation length
* foreach (permutations(['a', 'b','c'],2) as \$permutation) echo " | ".implode(',', \$permutation); = | a,b | a,c | b,a | b,c | c,a | c,b
*
* @param array \$set
* @param int \$numberInPermutation, null sets to count(\$set)
* @return Generator, empty on imposible permutations
*/ - echo "<ul>";
foreach(Permutation::permutations(['a','b','c'], 2); as $k => $v)
echo "<li>$v</li>";
echo "/<ul>";
- 0 := Array
(
[0] => a
[1] => b
)
- 1 := Array
(
[0] => a
[1] => c
)
- 2 := Array
(
[0] => b
[1] => a
)
- 3 := Array
(
[0] => b
[1] => c
)
- 4 := Array
(
[0] => c
[1] => a
)
- 5 := Array
(
[0] => c
[1] => b
)
- echo "<ul>";
foreach(Permutation::permutations(['a','b','c']); as $k => $v)
echo "<li>$k := ". print_r($v, true)."</li>";
echo "/<ul>";
- 0 := Array
(
[0] => a
[1] => b
[2] => c
)
- 1 := Array
(
[0] => a
[1] => c
[2] => b
)
- 2 := Array
(
[0] => b
[1] => a
[2] => c
)
- 3 := Array
(
[0] => b
[1] => c
[2] => a
)
- 4 := Array
(
[0] => c
[1] => a
[2] => b
)
- 5 := Array
(
[0] => c
[1] => b
[2] => a
)
|