Created
June 17, 2013 20:58
-
-
Save dashmug/5800353 to your computer and use it in GitHub Desktop.
A package that returns all the combinations and permutations, without repitition, of a given set and subset size. Associative arrays are preserved. Download from: http://pear.php.net/package/Math_Combinatorics/download
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_once 'Math/Combinatorics.php'; | |
$combinatorics = new Math_Combinatorics; | |
var_dump($combinatorics->combinations(array( | |
'one' => 'a', | |
'two' => 'b', | |
'three' => 'c', | |
'four' => 'd', | |
), 3)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_once 'Math/Combinatorics.php'; | |
$combinatorics = new Math_Combinatorics; | |
var_dump($combinatorics->permutations(array( | |
'one' => 'a', | |
'two' => 'b', | |
'three' => 'c', | |
'four' => 'd', | |
), 3)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment