PHP: How to push to an array an other array, but without it creating a new value to the array -
i have 2 numeric arrays. 1 starts 0 , ends 24 - , other starts 25 , ends 50.
i want merge/push 1 starts 25 continue first one. have new array starts 0 , ends 50.
i using array_push
isn't serving intentions, this:
how push array:
0 => string 'us' (length=2) 1 => string 'au' (length=2) 2 => string 'ca' (length=2) 3 => string 'cn' (length=2) 4 => string 'fr' (length=2) 5 => string 'de' (length=2) 6 => string 'gb' (length=2) 7 => string 'it' (length=2) 8 => string 'jp' (length=2) 9 => string 'kr' (length=2) 10 => string 'ru' (length=2) 11 => string 'dz' (length=2) 12 => string 'ao' (length=2) 13 => string 'ar' (length=2) 14 => string 'at' (length=2) 15 => string 'az' (length=2) 16 => string 'bb' (length=2) 17 => string 'by' (length=2) 18 => string 'be' (length=2) 19 => string 'bm' (length=2) 20 => string 'br' (length=2) 21 => string 'bg' (length=2) 22 => string 'cl' (length=2) 23 => string 'co' (length=2) 24 => string 'cr' (length=2) 25 => array 25 => string 'zz' 26 => string 'xx' 27 => string 'ww'
ect'.
this want like:
0 => string 'us' (length=2) 1 => string 'au' (length=2) 2 => string 'ca' (length=2) 3 => string 'cn' (length=2) 4 => string 'fr' (length=2) 5 => string 'de' (length=2) 6 => string 'gb' (length=2) 7 => string 'it' (length=2) 8 => string 'jp' (length=2) 9 => string 'kr' (length=2) 10 => string 'ru' (length=2) 11 => string 'dz' (length=2) 12 => string 'ao' (length=2) 13 => string 'ar' (length=2) 14 => string 'at' (length=2) 15 => string 'az' (length=2) 16 => string 'bb' (length=2) 17 => string 'by' (length=2) 18 => string 'be' (length=2) 19 => string 'bm' (length=2) 20 => string 'br' (length=2) 21 => string 'bg' (length=2) 22 => string 'cl' (length=2) 23 => string 'co' (length=2) 24 => string 'cr' (length=2) 25 => string 'zz' (length=2) 26 => string 'xx' (length=2) 27 => string 'ww' (length=2) ... ect'.
simply use:
$array = $arr1 + $arr2
or
array_merge($arr1, $arr2);
Comments
Post a Comment