0

I've the following arrays:

Array
(
    [13699] => Array
        (
            [0] => 13699
        )
)

Array
(
    [13699] => Array
        (
            [0] => 13699
            [1] => 13699
            [2] => 13699
            [3] => 13699
            [4] => 13699
        )

)

Both arrays have the same key(13699), how do i merge them to get the value from the second array added to the value of the first array? like this:

Array
    (
        [13699] => Array
            (
                [0] => 13699
                [1] => 13699
                [2] => 13699
                [3] => 13699
                [4] => 13699
                [5] => 13699
            )
    
    )

I've tried for hours with array_merge, and array_merge_recursive but without any luck to achieve what i want.

Thanks.

  • @miken32 that duplicate seems to be all about array_merge_recursive, but I think that won't work with numeric keys, e.g. https://3v4l.org/0n8od – Don't Panic May 13 '22 at 19:53
  • Before voting to reopen, be sure that all answers on that page do not resolve this question. Furthermore, if there are any other pre-existing pages that resolve this question, then the dupe target should be changed instead of voting to reopen. – mickmackusa May 14 '22 at 05:01
  • [`array_replace_recursive()?](https://3v4l.org/1PmGT) ... suggested here: [Wrong numeric key when using php array_merge_recursive](https://stackoverflow.com/q/27272569/2943403) – mickmackusa May 14 '22 at 05:11

0 Answers0