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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 13:52:08
Original
1256 people have browsed it

求助 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>
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
Latest Issues
How to create an array within an array?
From 1970-01-01 08:00:00
0
0
0
php array
From 1970-01-01 08:00:00
0
0
0
Array to array
From 1970-01-01 08:00:00
0
0
0
php array rotation
From 1970-01-01 08:00:00
0
0
0
array
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template