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

php多数组排列组合实例

WBOY
Release: 2016-06-23 13:22:59
Original
1200 people have browsed it

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;
Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template