PHP Classes

How Can PHP Calculate Combinations and Permutations of Numbers Using the Class Math Combinatorics: Combinations and permutations of a set of values

Recommend this page to a friend!
  Info   View files Example   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-06-28 (4 hours ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
math_combinatorics 1.0MIT/X Consortium ...7Math, PHP 7
Description 

Author

This class can get the combinations and permutations of a set of values.

It can take an array of numbers and calculate the combinations and the permutations between the numbers in the array.

The class returns an array with the resulting combinations and permutations.

Picture of Chun-Sheng, Li
  Performance   Level  
Name: Chun-Sheng, Li <contact>
Classes: 32 packages by
Country: Taiwan Taiwan
Innovation award
Innovation award
Nominee: 15x

Winner: 1x

Example

<?php

   
require_once 'Combinatorics.php';

   
$combinatorics = new Math_Combinatorics;
   
$set = range(0, 9);
   
   
$asc_num = 97;
    while (
$asc_num<= 122) {
       
# code...
       
array_push($set, chr($asc_num));
       
$asc_num++;
    }

   
//??
   
echo $combinations = $combinatorics->combinations($set, 16);
   
//??
    //$permutations = $combinatorics->permutations($set, 16);
?>


Details

Math_Combinatorics

This project is appropriate for someone who want to know about the combinations and permumentations.

different

If you use Math_Combinatorics, it will happen an error that show memories' limit.In order to solving problem,I tried to changing source code.I use file_put_content function that stroe strings when generating a new possible string right away. I also free the variable's memory which assigned the possible string so that it will not happen memories' error.

Requirement

It's only have to use PHP command line.

Dependency

It depends on this package: Math_Combinatorics


  Files folder image Files  
File Role Description
Plain text file Combinatorics.php Class Class source
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads  
 100%
Total:0
This week:0