I need a function which returns all possible combinations,
e.g.
chars = range('a', 'c');
- = a a a
- = a a b
- = a b a
- = a b b
- = a b c
- = a c b ... n. = c c c
(order doesn't matter)
and so on
i got this
function pc_permute($items, $perms = array( )) {
    if (empty($items)) {
        $return = array($perms);
    }  else {
        $return = array();
        for ($i = count($items) - 1; $i >= 0; --$i) {
             $newitems = $items;
             $newperms = $perms;
         list($foo) = array_splice($newitems, $i, 1);
             array_unshift($newperms, $foo);
             $return = array_merge($return, pc_permute($newitems, $newperms));
         }
    }
    return $return;
}
$p = pc_permute(array(0, 1, 2, 3));
var_dump($p);
from Here
But i wasn't able to figure out how to chance/rewrite this to get all possible combination with multiple same elements.
Thanks, Mohammer
 
     
    