-2

我有两个 Json 数组:

$arrayA = array("avg" => '1',"shape" => 'hey');

$arrayB = array("avg" => '2',"shape" => 'trapezoid');

我想使用javascriptor PHPas 将它们组合起来:

arrayAB = {"avg":['1', '2'], "shape":[hey', 'trapezoid']};  
4

1 回答 1

0
$arrayA = array("avg" => "234","shape" => "hey");
$arrayB = array("avg" => "5678","shape" => "trapezoid");
$array3 = array();

foreach ($arrayA as $key => $value) {
    $array3[$key] = array($arrayA[$key], $arrayB[$key]);
}
于 2012-08-21T04:18:44.777 回答