我有这两个数组,我想将它们合并为一个数组,但很难弄清楚。请参阅下面的两个代码片段:
第一个数组:
$propSelectMaxRow = max(array_keys($property_select_email));
$i = 0;
foreach($property_queue as $r) {
if ($select_type == 3 || $select_type == 4 || $select_type == 5) {
$i = $i + 1;
$property_select_email[$propSelectMaxRow + $i] = $r;
}
}
第二个数组:
$propSelectMaxRow = max(array_keys($property_select_email));
$i = 0;
foreach($property_select as $r) {
if ($select_type == 1 || $select_type == 2 || $select_type == 4 || $select_type == 5) {
$i = $i + 1;
$property_select_email[$propSelectMaxRow + $i] = $r;
}
}
编辑:我希望最终的数组看起来像这样:
第一种数组格式:
Array (
[1] => Array ( [code] => PPJ3 [street] => 34412 Fake Street [city] => Detroit [state] => MI [zip] => 48223 )
[2] => Array ( [code] => PLK3 [street] => 73517 Fake Street [city] => Detroit [state] => MI [zip] => 48223 )
[3] => Array ( [code] => HYK2 [street] => 55224 Fake Street [city] => Detroit [state] => MI [zip] => 48208 )
)
第二种数组格式:
Array (
[1] => Array ( [code] => JAK932 [street] => 353242 Fake Street [city] => Detroit [state] => MI [zip] => 48223 )
[2] => Array ( [code] => JA232 [street] => 7432 Fake Street [city] => Detroit [state] => MI [zip] => 48223 )
)
最终数组格式应为:
Array (
[1] => Array ( [code] => PPJ3 [street] => 34412 Fake Street [city] => Detroit [state] => MI [zip] => 48223 )
[2] => Array ( [code] => PLK3 [street] => 73517 Fake Street [city] => Detroit [state] => MI [zip] => 48223 )
[3] => Array ( [code] => HYK2 [street] => 55224 Fake Street [city] => Detroit [state] => MI [zip] => 48208 )
[4] => Array ( [code] => JAK932 [street] => 353242 Fake Street [city] => Detroit [state] => MI [zip] => 48223 )
[5] => Array ( [code] => JA232 [street] => 7432 Fake Street [city] => Detroit [state] => MI [zip] => 48223 )
)