Skip to content
Advertisement

Merge multidimensional Array PHP without changing the key

i have a problem to merge this array, I want to merge this array bellow

JavaScript

and the expected result will be like this

JavaScript

without changing the key..

Thankyou.

Advertisement

Answer

You can use Array Operators + to do that. You can check my below demo:

JavaScript

The result will be:

JavaScript

You can find out more at https://www.php.net/manual/en/language.operators.array.php

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