Home >Backend Development >PHP Tutorial >php多数组排列组合实例

php多数组排列组合实例

WBOY
WBOYOriginal
2016-06-23 13:22:591229browse

function zuhe($arr){    if(count($arr) >= 2){        $tmparr = array();        $arr1 = array_shift($arr);        $arr2 = array_shift($arr);        foreach($arr1 as $k1 => $v1){            foreach($arr2 as $k2 => $v2){                $tmparr[] = $v1.$v2;            }        }        array_unshift($arr, $tmparr);        $arr = zuhe($arr);    }else{        return $arr;    }    return $arr;}$arr = array(    array(1,2),    array('a','b'),    array('c','d'));print_r(zuhe($arr));exit;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn