<?php
$array [0]= array (1,2,3,4,5);
$array [1]= array ( 'a' , 'b' , 'c' );
print_r(action( $array )); //传入一个二维数组,启动计算
function action( $array ){
$num = count ( $array )-2;
$val =reckon( $array [0], $array [1]);
for ( $i =0; $i < $num ; $i ++){
$val =reckon( $val , $array [ $i +2]);
}
return $val ;
}
//两个两个数组组合
function reckon( $arr1 , $arr2 ){
$val = array ();
$n =0;
for ( $i =0; $i < count ( $arr1 ); $i ++){
for ( $k =0; $k < count ( $arr2 ); $k ++){
$val [ $n ]= "$arr1[$i - $arr2[$k" ;
$n ++;
}
}
return $val ;
}
//分解组合过的数组
function resolved( $varchar , $string = '-' ){
$arr = explode ( $string , $varchar ,-1);
return $arr ;
}
|