static function _getInsidersCombinations(&$insiders, $size, $pos = 0) { if ($size <= 0) { return array(1); } $return = array(); $end = count($insiders) - $size; for ($i = $pos; $i <= $end; $i++) { $subtree = Approximation::_getInsidersCombinations($insiders, $size - 1, $i + 1); foreach ($subtree as $value) { $return[] = $insiders[$i] * $value; } } return $return; }