I have two data objects converted from JSON. both are quite deeply complex and I'd like to merge them in a similar fashion to how jQuery would merge two objects using extend.
example
JSON 1:
{
...
"blah":
{
"params":
{
"foo":
{
"default": "bar",
"misc": "0",
...
},
...
},
...
},
...
}
JSON 2:
{
...
"blah":
{
"params":
{
"foo":
{
"value": "val",
"misc": "1",
...
},
...
},
...
},
...
}
Merged into
{
...
"blah":
{
"params":
{
"foo":
{
"default": "bar",
"value": "val",
"misc": "1",
...
},
...
},
...
},
...
}
What's the best way to approach this with PHP objects.
See Question&Answers more detail:os