how to join two multidimensional arrays in php? I have two multidimensional arrays A and B. I need to join A and B to form a new array C as follows
$A = array(
array("a1"=>1,"b1"=>2,"c1"=>"A"),
array("a1"=>1,"b1"=>16,"c1"=>"Z"),
array("a1"=>3,"b1"=>8,"c1"=>"A"));
$B = array(
array("a2"=>1,"b2"=>2,"b2"=>"A"),
array("a2"=>1,"b2"=>16,"b2"=>"G"),
array("a2"=>3,"b2"=>8,"b2"=>"A"));
//join A and B to form C
$C=array(
array("a1"=>1,"b1"=>2,"c1"=>"A"),
array("a1"=>1,"b1"=>16,"c1"=>"Z"),
array("a1"=>3,"b1"=>8,"c1"=>"A"),
array("a2"=>1,"b2"=>2,"b2"=>"A"),
array("a2"=>1,"b2"=>16,"b2"=>"G"),
array("a2"=>3,"b2"=>8,"b2"=>"A"));
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…