"> Two-dimensional array merges one-dimensional array-PHP Chinese Network Q&A
Two-dimensional array merges one-dimensional array
三言
三言 2019-03-04 16:17:05
0
4
1225
$arr = array(2) { [0]=> array(3) { [0]=> string(1) "1" [1]=> string(1) "2" [2]=> string(1) "3" } [1]=> array(3) { [0]=> string(1) "4" [1]=> string(1) "5" [2]=> string(1) "6" } } //这种数组换成一维数组$arr1(14,15,16,24,25,26);count($arr)无限大,所有可能性,怎么弄


三言
三言

reply all (2)
三言
//排列组合 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; }


    韦小宝

    What does it mean? I don’t understand.

    • reply All permutations and combinations have been solved
      三言 author 2019-03-05 10:57:08
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!