本文整理汇总了PHP中tool::get_combination方法的典型用法代码示例。如果您正苦于以下问题:PHP tool::get_combination方法的具体用法?PHP tool::get_combination怎么用?PHP tool::get_combination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tool
的用法示例。
在下文中一共展示了tool::get_combination方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zhushu
/**
* 计算出彩票的注数 适用于竞彩部分
* Enter description here ...
* @param unknown_type $code
* codes:46:[1,2]/47:[胜]/48:[胜]/49:[胜]
* @param unknown_type $chuanfa
* 2串1
*/
public function zhushu($codes, $chuanfa)
{
$arrcode = explode('/', $codes);
if ($chuanfa == '单关') {
$chuan_code = 1;
} else {
$chuans = explode('串', $chuanfa);
$chuan_code = $chuans[0] . $chuans[1];
}
$zhushu_info = self::$zhushufenpei[$chuan_code];
$return = 0;
for ($i = 0; $i < count($zhushu_info); $i++) {
if ($zhushu_info[$i] > 0) {
$j = $i + 1;
$r = tool::get_combination($arrcode, $j, '/');
for ($k = 0; $k < count($r); $k++) {
$code_t1 = explode('/', $r[$k]);
$match_re = 1;
for ($l = 0; $l < count($code_t1); $l++) {
$t1 = explode(':', $code_t1[$l]);
$match_no = $t1[0];
$no_len = strlen($match_no) + 2;
$t2 = substr(substr($code_t1[$l], $no_len), 0, -1);
$t3 = explode(',', $t2);
$match_re *= count($t3);
}
$return += $match_re;
}
}
}
return $return;
}
示例2: get_combination
public static function get_combination($arr, $m, $char = ',')
{
$result = array();
if ($m == 1) {
return $arr;
}
if ($m == count($arr)) {
$result[] = implode($char, $arr);
return $result;
}
$temp_firstelement = $arr[0];
unset($arr[0]);
$arr = array_values($arr);
$temp_list1 = tool::get_combination($arr, $m - 1, $char);
foreach ($temp_list1 as $s) {
$s = $temp_firstelement . $char . $s;
$result[] = $s;
}
unset($temp_list1);
$temp_list2 = tool::get_combination($arr, $m, $char);
foreach ($temp_list2 as $s) {
$result[] = $s;
}
unset($temp_list2);
return $result;
}