Lets say I have these arrays:
$array1 = [
'test' => json_encode([
'key1' => 'val1',
'key2' => 'val2',
'key3' => 'val3'
])
]
$array2 = [
'test' => json_encode([
'key4' => 'val4'
])
]
$array3 = [
'test' => json_encode([
'key1' => 'val1',
'key2' => 'val2',
'key3' => 'val3',
'key4' => 'val4',
])
]
$result = array_merge($array1, $array2)
$array3 = [
'test' => json_encode([
'key4' => 'val4'
])
]
array_merge_recursive
I fixed this to by putting the test
key in it's own variable.
Then I merged them and json_encoded it.