Skip to content
Advertisement

Merge two indexed arrays of indexed arrays based on first column value

I have two arrays like this:

JavaScript

How can I merge these two arrays without looping? Is there any php functionality available for this? I need this kind of output:

JavaScript

Advertisement

Answer

You can use the PHP function array_merge_recursive. See the example:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement