I have following array :
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
)
)
And same is the 2nd array :
Array
(
[0] => Array
(
[id] => 103
[title] => Activities
)
[1] => Array
(
[id] => 76
[title] => Top 10 Ideas
)
[2] => Array
(
[id] => 9
[title] => Best Shopping Areas
)
)
I want to append 1st array into 2nd array if count of 1st array is less than 3 so for that I used array push function and did like this :
if (count($secondArr) < 3) {
echo "<pre>";
echo array_push($secondArr, $firstArr);
print_r($result);
exit;
}
Now after array_push it showing the array like this (multidimensional)
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
)
)
)
I dont want like this (multidimensional). I want it to append with key 4,5 and so on. Can it possible if yes then how?
Thanks.