我想合并具有各种对象的数组
L.Circle
答案 0 :(得分:0)
使用php array_merge
array_merge($arr1,$arr2,$arr3).
试试这段代码: -
<?php
$arr=array("zip"=> "560045", "count"=> 1);
$arr1=array("city"=> "Bangalore", "count"=> 1);
$arr2=array("acount"=> 3, "answer"=> "fgdfgd", "question"=> "comment-about-me-");
print_r(array_merge($arr,$arr1,$arr2));
?>
答案 1 :(得分:0)
在我看来,在PHP中,你应该这样使用:
$arr = array("zip" => "560045", "count" => 1);
//array2
$arr1 = array("city" => "Bangalore", "count" => 1);
//array3
$arr2 = array("acount" => 3, "answer" => "fgdfgd", "question" => "comment-about-me-");
然后:
$final = array_merge($arr, $arr1, $arr2);