hegland / 组合数学
获取数组 / 写入文件 / 遍历通过字符的所有组合,长度由定义确定。
dev-master
2016-11-06 18:07 UTC
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: ~5.3.0
This package is auto-updated.
Last update: 2024-09-08 04:36:46 UTC
README
获取数组 / 写入文件 / 遍历通过字符的所有组合,长度由定义确定。
排列
有重复
// 即将推出
无重复
// 即将推出
错排
有重复
// 即将推出
无重复
// 即将推出
组合
有重复
$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 */
无重复
// 即将推出