PHP算法 参数组合,多个分类不同组合列表
来源:互联网 发布:mysql数据备份方案 编辑:程序博客网 时间:2024/05/24 04:12
算法:多个属性不同的组合
/*** 風.Fox*/class test { //组合 public static $attNew=array(); //源 public static $att=array(); //个数 public static $attCount=0; /** * 格式化行 */ public function formatRow(){ //属性 $att=array(1 =>array(1,2,3,4), 5 =>array(6,7,8,9), 10 =>array(11,12,13) ); if(is_array($att))foreach($att as $x){ self::$att[]=$x; } //属性个数 self::$attCount=count(self::$att); $this->Combination(); print_r(self::$attNew); } /** * 组合 */ public function Combination(){ $num = func_num_args(); if($num==0){ call_user_func_array(array($this,__FUNCTION__),array($num)); }else{ $t=func_get_args(); $num =$num-1; $i=$t[$num]; if(is_array(self::$att))foreach(self::$att[$i] as $r){ if(self::$attCount>0&&self::$attCount==($i+1)){ $a=array(); for($x=0;$x<$num;$x++){ $a[]=$t[$x]; } $a[]=$r; self::$attNew[]=$a; //return $s; }else{ $arr=array(); for($x=0;$x<$num;$x++){ $arr[]=$t[$x]; } $arr[]=$r; $arr[]=$i+1; if($num>20){ exit('break;'); break; } call_user_func_array(array($this,__FUNCTION__),$arr); } } } }}$test=new test();$test->formatRow();
- PHP算法 参数组合,多个分类不同组合列表
- Leetcode分类解析:组合算法
- php多个数组求组合数
- php 数组遍历组合算法
- php算法 阶乘、排列、组合
- 参数组合
- PHP输出多个元素的排列排列或组合
- php中将多个数组组合成笛卡尔积!
- php 组合算法(从n个数中取出m个元素进行组合,不考虑排序和元素重复)
- 组合算法
- 组合算法
- 组合算法
- 组合算法
- 组合算法
- 组合算法
- 组合算法
- 组合算法
- 组合算法
- struts2.0、hibernate3、spring2.5框架整合流程实例
- 图像的配准及在VC++中实现
- CSDN-FENG 2013.11
- java中重载与重写的区别
- 计算运行耗时
- PHP算法 参数组合,多个分类不同组合列表
- 完善ing——输入年月日输出这一年为该年的第多少天
- 避免 C/C++ 程序一闪而过的方法
- 输入年月日求其为本年第几天
- 对栈,堆,静态区的认识
- JNI初步 -- Hello JNI示例
- PHP 日期 加减 月数,天数,周数,小时,分,秒等等
- 搜索工具库Lucence名称的来源,lucence是什么意思?Lucene是Doug妻子的中名 ,同时也是他外祖母的姓
- Map对象用JSON反序列化的方法