Home >Backend Development >PHP Tutorial > 3个数组 合并成一个二维数组有关问题

3个数组 合并成一个二维数组有关问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 13:52:081247browse

求助 3个数组 合并成一个二维数组问题
简化一下数据,数据像这样的形式。
$a=array(A);
$b=array(B,BB,BBB);
$c=array(C,CC,CCC,CCCC);


 现在要合并成这样一个数组:

$d=(
A=array(C),
B=array(CC),
BB=array(CCC),
BBB=array(CCCC)

)

这个怎么操作一下呢。

------解决方案--------------------

PHP code
$a=array(A);
$b=array(B,BB,BBB);
$c=array(C,CC,CCC,CCCC);

foreach(array_merge($a, $b) as $i=>$k)
  $d[$k] = $c[$i];

print_r($d); <div class="clear">
                 
              
              
        
            </div>
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