我有以下数组:
Array
(
[0] => Array
(
[id] => 23
[title] => jkl
)
[1] => Array
(
[id] => 478
[title] => lmn
)
[2] => Array
(
[id] => 22
[title] => pqr
)
[3] => Array
(
[id] => 21
[title] => abc
)
)
同样是第二个数组:
Array
(
[0] => Array
(
[id] => 103
[title] => Activities
)
[1] => Array
(
[id] => 76
[title] => Top 10 Ideas
)
[2] => Array
(
[id] => 9
[title] => Best Shopping Areas
)
)
如果第一个数组的计数小于 3,我想将第一个数组附加到第二个数组中,因此我使用了数组推送功能并这样做:
if (count($secondArr) < 3) {
echo "<pre>";
echo array_push($secondArr, $firstArr);
print_r($result);
exit;
}
现在在 array_push 之后显示这样的数组(多维)
Array
(
[0] => Array
(
[id] => 76
[title] => Activities
)
[1] => Array
(
[id] => 103
[title] => Top 10 Ideas
)
[2] => Array
(
[id] => 9
[title] => Best Shopping Areas
)
[3] => Array
(
[0] => Array
(
[id] => 23
[title] => jkl
)
[1] => Array
(
[id] => 478
[title] => lmn
)
[2] => Array
(
[id] => 22
[title] => pqr
)
[3] => Array
(
[id] => 21
[title] => abc
)
)
)
我不想这样(多维)。我希望它附加键 4,5 等等。如果是的话,那有可能吗?
谢谢。