ARRAY1:
Array (
[0] => Array (
[name] => January
[scale_of_pay] => 7800-39000
[pay] => 25000
[grade_pay] => 5000
[d_a] => 5000
[h_r_a] => 5000
[t_a] => 1000
[other] => 5000
[net_claim] => 46000
)
数组2:
Array (
[0] => Array (
[national_two_bank] => 700
[bhgylaxshmi_banks] => 1000
[maheshwari_bank] => 1000
[maha_bank] => 1000
[mahesh_cooperative_bank] => 1000
[co_operative] => 1000
[lic] => 1000
[total_deduction] => 6700
)
想要答案如下:
Array (
[0] => Array (
[name] => January
[scale_of_pay] => 7800-39000
[pay] => 25000
[grade_pay] => 5000
[d_a] => 5000
[h_r_a] => 5000
[t_a] => 1000
[other] => 5000
[net_claim] => 46000
[national_two_bank] => 700
[bhgylaxshmi_banks] => 1000
[maheshwari_bank] => 1000
[maha_bank] => 1000
[mahesh_cooperative_bank] => 1000
[co_operative] => 1000
[lic] => 1000
[total_deduction] => 6700
)
当我使用array_merge回答合并数组时,回答就像,
Array(
[0] => Array(
[name] => January[scale_of_pay] => 7800 - 39000[pay] => 25000[grade_pay] => 5000[d_a] => 5000[h_r_a] => 5000[t_a] => 1000[other] => 5000[net_claim] => 46000
) [1] => Array(
[name] => February[scale_of_pay] => 7800 - 39000[pay] => 25000[grade_pay] => 5000[d_a] => 5000[h_r_a] => 5000[t_a] => 1000[other] => 5000[net_claim] => 46000
) [2] => Array(
[name] => March[scale_of_pay] => 7800 - 39000[pay] => 25000[grade_pay] => 5000[d_a] => 5000[h_r_a] => 5000[t_a] => 5000[other] => 5000[net_claim] => 50000
) [3] => Array(
[national_two_bank] => 700[bhgylaxshmi_banks] => 1000[maheshwari_bank] => 1000[maha_bank] => 1000[mahesh_cooperative_bank] => 1000[co_operative] => 1000[lic] => 1000[total_deduction] => 6700
) [4] => Array(
[national_two_bank] => 1000[bhgylaxshmi_banks] => 1000[maheshwari_bank] => 1000[maha_bank] => 1000[mahesh_cooperative_bank] => 1000[co_operative] => 1000[lic] => 1000[total_deduction] => 7000
) [5] => Array(
[national_two_bank] => 1000[bhgylaxshmi_banks] => 1000[maheshwari_bank] => 1000[maha_bank] => 1000[mahesh_cooperative_bank] => 1000[co_operative] => 1000[lic] => 1000[total_deduction] => 7000
)
)
我不想这样......
答案 0 :(得分:0)
您想使用array_merge功能。在您的具体示例中,它就像array_merge($array1[0], $array2[0])
这是一个例子
<?php
$array1 = array( array( 'test' => 'testing1', 'test2' => 'testing2' ) );
$array2 = array( array( 'test3' => 'testing3', 'test4' => 'testing4' ) );
print_r( array_merge( $array1[0], $array2[0] ) );
?>
此输出
数组([test] =&gt; testing1 [test2] =&gt; testing2 [test3] =&gt; testing3 [test4] =&gt; testing4)
答案 1 :(得分:0)