Combinations is a PHP class that is used to generate combinations with or without repetition allowed as well as permutations with or without repetition allowed.
Example script is included in the package. (example.php)
- Permutations with two elements (no repetition is allowed):
[[A,B] ,[A,C] ,[A,D] ,[B,A] ,[B,C] ,[B,D] ,[C,A] ,[C,B] ,[C,D] ,[D,A] ,[D,B] ,[D,C]]
- Permutations with two elements (repetition is allowed):
[[A,A] ,[A,B] ,[A,C] ,[A,D] ,[B,A] ,[B,B] ,[B,C] ,[B,D] ,[C,A] ,[C,B] ,[C,C] ,[C,D] ,[D,A] ,[D,B] ,[D,C] ,[D,D]]
- Combinations with two elements (no repetition is allowed):
[[A,B] ,[A,C] ,[A,D] ,[B,C] ,[B,D] ,[C,D]]
- Combinations with two elements (repetition is allowed):
[[A,A] ,[A,B] ,[A,C] ,[A,D] ,[B,B] ,[B,C] ,[B,D] ,[C,C] ,[C,D] ,[D,D]]
- setElements()
- getCombinations()
- getPermutations()
- PHP 5 >= 5.5.0
Thanks for checking out this class! If you have improvement idea or bug fix, please feel free to contribute this class.
Ovunc Tukenmez
[email protected]