Informática Asociada ia doc & examples Index Examples List

Documentation jit ia\Math\Permutation Documentation Function examples Index Examples List

class ia\Math\Permutation


Index Documentation Function examples Index Examples List

ia\Math\Permutation


Examples by function ia\Math\Permutation Documentation Function examples Index Examples List

ia\Math\Permutation

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
         */
    1. 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
         */
    1. 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 )
    2. 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 )

End: ia\Math\Permutation Documentation Function examples Index Examples List