2017 © Pedro Peláez
 

library combinatorics

Get array / write file / iterate through all combinations of passed characters with defined length.

image

hegland/combinatorics

Get array / write file / iterate through all combinations of passed characters with defined length.

  • Sunday, November 6, 2016
  • by rogerhegland
  • Repository
  • 1 Watchers
  • 0 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Get array / write file / iterate through all combinations of passed characters with defined length., (*1)

Permutation

With repetition

// coming soon, (*2)

Without repetition

// coming soon, (*3)

Variation

With repetition

// coming soon, (*4)

Without repetition

// coming soon, (*5)

Combination

With repetition

$combination = new Combination();
$combination->setCharacters('ab')->setSize(2);

$combinations = $combination->get();
// = $combinations = [ 'aa', 'ab', 'ba', 'bb' ]


$combinations = [];
while (( $combination = $combination->next() ) !== false) {
    $combinations[] = $combination;
}
// = $combinations = [ 'aa', 'ab', 'ba', 'bb' ]


$combination->write('combinations.txt', PHP_EOL);
/*
file "combinations.txt" with the following content:
aa
ab
ba
bb
*/

Without repetition

// coming soon, (*6)

The Versions

06/11 2016

dev-master

9999999-dev https://github.com/rogerhegland/combinatorics

Get array / write file / iterate through all combinations of passed characters with defined length.

  Sources   Download

Apache License 2.0

The Requires

  • php >=7.0

 

The Development Requires

by Roger Hegland

combination combinatorics permutation variation