PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Ovunc Tukenmez  >  Combination Class  >  README.md  >  Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Combination Class
Generate combinations of an array of values
Author: By
Last change:
Date: 4 years ago
Size: 1,320 bytes
 

Contents

Class file image Download

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.