Jump to content

Array_merge()


Samuz

Recommended Posts

So I have two arrays (soon to be multiple).

 

What I want to do is merge all those arrays into one, so that I can then proceed to inserting the data all together.

 

Here's an example of what array1 looks like.

 

        Array
(
    [0] => Array
        (
            [name] => samus1
            [forum] => phpfreaks.com
        )

    [1] => Array
        (
            [name] => samus2
            [forum] => stackoverflow.com
        )
)

 

And array2:

 

        Array
(
    [0] => Array
        (
            [posts] => 25
        )

    [1] => Array
        (
            [posts] => 2500
        )
)

 

I then tried to do:

 

print_r(array_merge($array1, $array2));

 

Yet it prints nothing?

 

When I print the other arrays individually the values are shown, but after I use array_merge() it doesn't.

 

Anyone got an idea why?

Link to comment
https://forums.phpfreaks.com/topic/262666-array_merge/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.