File: README.md Documentation text/markdown Documentation Combination Class Generate combinations of an array of values By Ovunc Tukenmez 4 years ago 1,320 bytes

# Combinations PHP Class

<strong>Combinations </strong> is a <strong>PHP</strong> 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)<br /> <h2>Sample Calculations Using ['A', 'B', 'C', 'D'] Set</h2> <ul> <li>Permutations with two elements (no repetition is allowed):<br>

[[A,B] ,[A,C] ,[A,D] ,[B,A] ,[B,C] ,[B,D] ,[C,A] ,[C,B] ,[C,D] ,[D,A] ,[D,B] ,[D,C]]

</li> <li>Permutations with two elements (repetition is allowed):<br>

[[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]]

</li> <li>Combinations with two elements (no repetition is allowed):<br>

[[A,B] ,[A,C] ,[A,D] ,[B,C] ,[B,D] ,[C,D]]

</li> <li>Combinations with two elements (repetition is allowed):<br>

[[A,A] ,[A,B] ,[A,C] ,[A,D] ,[B,B] ,[B,C] ,[B,D] ,[C,C] ,[C,D] ,[D,D]]

</li> </ul>

<h2>Public Methods of Class</h2> <ul> <li>setElements()</li> <li>getCombinations()</li> <li>getPermutations()</li> </ul>

<h2>Class Requirements</h2> <ul> <li>PHP 5 >= 5.5.0</li> </ul>

Thanks for checking out this class! If you have improvement idea or bug fix, please feel free to contribute this class.<br /> <br /> <br /> Ovunc Tukenmez ovunct@live.com

For more information send a message to `info at phpclasses dot org`.