I\'ve looked everywhere for this online, but couldn\'t completely find it. (my PHP and math skills are letting my down for this one...) I have an array containing for exampl
It looks like you're asking for the "power set". the power set includes the empty set, which i wont include.
require_once 'Math/Combinatorics.php';
$set = range('a', 'c');
$permutationSizes = range(1, count($set));
$combinatorics = new Math_Combinatorics;
$result = array();
foreach ($permutationSizes as $permutationSize) {
$result = array_merge($result, $combinatorics->permutations($set, $permutationSize));
}
print_r($result);
http://pear.php.net/package/Math_Combinatorics
I guess technically this isnt a power set because i'm assuming order matters when comparing sets. anyway...