我有两阵列,我只是试图把我们合并成一个功能:
$var1=array();
$myInputVar=array();
$var1[ something ][ secondary_something ][]="foo1";
$var1[ something ][ secondary_something ][]="foo2";
$var1[ something ][ secondary_something ][]="foo3";
$myInputVar[ something ][ secondary_something ][]="foo4";
$myInputVar[ something ][ secondary_something ][]="foo5";
function something(&$array_, $array_new) {
$array = array_merge($array_ , $array_new);
print_r($array);//for debugging
}
something($var1, $myInputVar);
Now that prints:
Array ( [something] => Array ( [secondary_something] => Array ( [0] => foo1 [1] => foo2 [2] => foo3 ) ) )
我期待:
Array ( [something] => Array ( [secondary_something] => Array ( [0] => foo1 [1] => foo2 [2] => foo3 [3] => foo4 [4] => foo5) ) )
我还尝试:
$array = $array_ + $array_new;
那些仍然没有印刷我所期望的东西。
我感觉到,我误解了<代码>array_joint()功能的目的,这就是为什么它不退回结果I m期望它返回的原因。
任何想法?